Opened 6 years ago

Closed 6 years ago

#1427 closed defect (invalid)

how can I remove_header ?

Reported by: crucifyer@… Owned by:
Priority: minor Milestone:
Component: other Version: 1.13.x
Keywords: Cc:
uname -a: Linux mypc 3.13.0-132-generic #181-Ubuntu SMP Wed Sep 13 13:25:03 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.4.6 (Ubuntu)
built by gcc 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/ --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_spdy_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module


I try add .js.gz

location /gz/ {

add_header Content-Type application/x-javascript;
add_header Content-Encoding gzip;


wget --save-headers "http://site/gz/script.js.gz" -O script.js

HTTP/1.1 200 OK
Server: nginx
Date: Mon, 13 Nov 2017 09:34:33 GMT
Content-Type: application/octet-stream ## I want remove this.
Content-Length: 323
Last-Modified: Mon, 13 Nov 2017 08:56:37 GMT
Connection: keep-alive
ETag: "5a095e45-143"
Content-Type: application/x-javascript
Content-Encoding: gzip
Accept-Ranges: bytes

mime.types file cannot add js.gz

Change History (1)

comment:1 by Maxim Dounin, 6 years ago

Resolution: invalid
Status: newclosed

Try using appropriate default_type instead, with an empty types block:

location /gz/ {
    types { }
    default_type application/x-javascript;
    add_header Content-Encoding gzip;

You may also want to consider using the gzip static module instead.

If you have further questions, please use support options available. Thank you.

Note: See TracTickets for help on using tickets.