Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#691 closed defect (wontfix)

ERR_SPDY_PROTOCOL_ERROR in Chrome when doing add_header

Reported by: Artemy Tregubenko Owned by:
Priority: minor Milestone:
Component: nginx-core Version: 1.6.x
Keywords: ssl, spdy Cc:
uname -a: Linux arty.name 2.6.32-042stab094.8 #1 SMP Tue Dec 16 20:36:56 MSK 2014 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.6.2
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -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/nginx.pid --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_auth_request_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 --add-module=/build/buildd/nginx-1.6.2/debian/modules/nginx-auth-pam --add-module=/build/buildd/nginx-1.6.2/debian/modules/nginx-dav-ext-module --add-module=/build/buildd/nginx-1.6.2/debian/modules/nginx-echo --add-module=/build/buildd/nginx-1.6.2/debian/modules/nginx-upstream-fair --add-module=/build/buildd/nginx-1.6.2/debian/modules/ngx_http_substitutions_filter_module

Description

I am using nginx-full 1.6.2-5+precise0 from the PPA http://ppa.launchpad.net/nginx/stable/ubuntu/ on Ubuntu 12.04

In one of the server configurations I have following section:

location ~ \d/$ {

if ($http_accept ~ (text|application)/x?html) {

add_header Content-Type "text/html; charset=utf-8";
rewrite (.*)/$ $1/index.html break;

}

}

I have noticed recently that requests to these URLs over HTTPS result in Chrome error ERR_SPDY_PROTOCOL_ERROR (even when I disable spdy). I will attach the log from chrome://net-internals/#spdy

I saw that removing add_header directive fixes this issue.

I only saw that in Chrome, Firefox was okay. Chrome version was 39.0.2171.95 (64-bit), I couldn't try other versions.

Attachments (1)

chrome-log.txt (11.9 KB ) - added by Artemy Tregubenko 10 years ago.
log from chrome://net-internals/#spdy

Download all attachments as: .zip

Change History (3)

by Artemy Tregubenko, 10 years ago

Attachment: chrome-log.txt added

log from chrome://net-internals/#spdy

comment:1 by Maxim Dounin, 10 years ago

Resolution: wontfix
Status: newclosed

Use of "add_header Content-Type ..." will result in a duplicate Content-Type header in a response. There is no surprise it causes problems in some cases. Note that the "add_header" directive is a low-level one and should be used with care - in particular, it's bad idea to try to use it to overwrite standard headers.

Instead, use the default_type and types directives to control MIME type of responses, and charset to set charset as needed.

comment:2 by Artemy Tregubenko, 10 years ago

the "add_header" directive is a low-level one and should be used with care

I see. It would be nice to add this line to the documentation, because the breakage of a low-level protocol is not something you'd expect from adding a directive.

Note: See TracTickets for help on using tickets.