Welcome! Log In Create A New Profile

Advanced

Possible nginx bug - gzip off for a a location not working

Posted by konkhra 
Possible nginx bug - gzip off for a a location not working
November 08, 2019 09:10AM
I am trying to set gzip off in a specific location " ~ /wp-content/cache/supercache.*gz$ " but nginx is not considering it. Bellow is some code from vhost config file.

The browser displays the content in text/plain format not text/html as it is set in the location. I mention that I receive no errors from nginx.

set $full_cachefile '/wp-content/cache/supercache/$http_host${condition}';
set $full_gzipcachefile '/wp-content/cache/supercache/$http_host${condition}';


location ~ /wp-content/cache/supercache.*html$ {
add_header Vary "Accept-Encoding, Cookie";
add_header Pragma "public";
add_header Cache-Control "max-age=3600, public";
}


location ~ /wp-content/cache/supercache.*gz$ {
gzip off;
types {}
default_type text/html;
add_header Vary "Accept-Encoding, Cookie";
add_header Pragma "public";
add_header Cache-Control "max-age=3600, public";
add_header Content-Encoding gzip;
}



location / {

set $cachefile $full_cachefile${uri}index-https.html;
set $gzipcachefile $full_cachefile${uri}index-https.html.gz;

try_files $gzipcachefile $cachefile $uri $uri/ /index.php$is_args$args;
}




location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_buffers 256 16k;
fastcgi_buffer_size 128k;
fastcgi_connect_timeout 3s;
fastcgi_send_timeout 120s;
fastcgi_read_timeout 120s;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
reset_timedout_connection on;
include fastcgi_params;
#fastcgi_pass 127.0.0.1:9012;
fastcgi_pass unix:/tmp/lunarp.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 175
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready