Answer the question
In order to leave comments, you need to log in
Why is there a duplicate request?
Hello! The problem is this: I raised the php stack (nginx + postgres + php-fpm) in docker containers. I wrote a simple script that writes to the database:
$pg = @pg_connect("host=$DB_HOST port=$DB_PORT dbname=$DB_NAME user=$DB_USER password=$DB_PASS");
pg_query($pg, 'INSERT INTO msg (name, text) VALUES (\'name1\', \'message\')');
server {
listen 80;
server_name localhost;
rewrite ^ https://localhost? permanent;
}
server {
listen 443 ssl http2;
index index.php;
server_name localhost;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/hello.local;
client_max_body_size 35M;
gzip on;
ssl on;
ssl_certificate /etc/nginx/ssl/server-cert.crt;
ssl_certificate_key /etc/nginx/ssl/server-key.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "ECDHE-ECDSA-CHACHA20-POLY1305 ECDHE-RSA-CHACHA20-POLY1305 ECDHE-ECDSA-AES128-GCM-SHA256 ECDHE-RSA-AES128-GCM-SHA256 ECDHE-ECDSA-AES256-GCM-SHA384 ECDHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES128-GCM-SHA256 DHE-RSA-AES256-GCM-SHA384 ECDHE-ECDSA-AES128-SHA256 ECDHE-RSA-AES128-SHA256 ECDHE-ECDSA-AES128-SHA ECDHE-RSA-AES256-SHA384 ECDHE-RSA-AES128-SHA ECDHE-ECDSA-AES256-SHA384 ECDHE-ECDSA-AES256-SHA ECDHE-RSA-AES256-SHA DHE-RSA-AES128-SHA256 DHE-RSA-AES128-SHA DHE-RSA-AES256-SHA256 DHE-RSA-AES256-SHA ECDHE-ECDSA-DES-CBC3-SHA ECDHE-RSA-DES-CBC3-SHA !DSS !aNULL !eNULL !EXPORT !3DES !DES !RC4 !MD5 !PSK !aECDH !EDH-DSS-DES-CBC3-SHA !EDH-RSA-DES-CBC3-SHA !KRB5-DES-CBC3-SHA";
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
add_header Strict-Transport-Security "max-age=15724800";
location ~ /libs {
deny all;
}
location / {
if (!-e $request_filename){
rewrite ^/(.*) /?$query_string;
}
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
Answer the question
In order to leave comments, you need to log in
Check how many requests the browser is making directly.
For example, the favicon.
- Doctor, when I do this, it hurts
. - Well, don't do this.
First, we redirect all requests for non-existent files to the index .
Then we make an unconditional request to the database in the index
. And then we begin to wonder why this request suddenly fires every time a non-existent file is accessed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question