Opened 4 months ago

Closed 4 months ago

#1827 closed defect (duplicate)

Enabling http2 for one server block enables it for all

Reported by: mattpr@… Owned by:
Priority: minor Milestone:
Component: nginx-module Version: 1.10.x
Keywords: http2, ngx_http_v2_module Cc:
uname -a: Linux [hostname redacted] 4.4.0-157-generic #185-Ubuntu SMP Tue Jul 23 09:17:01 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.10.3 (Ubuntu) built with OpenSSL 1.0.2g 1 Mar 2016 TLS SNI support enabled configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --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_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads

Description

Enabling http2 for one server block apparently enables it for other SSL server blocks.
If this is a feature I am not finding the documentation explaining the behaviour anywhere.

Expected: http2 is only enabled for server blocks where http2 is enabled.

Example config:

# redir secure root domain to www
server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name redactedhostname.com;

    ssl_certificate certs/redactedhostname.com.crt;
    ssl_certificate_key certs/redactedhostname.com.key;
    
    # add -- to middle of hostname to make obvious to test client when we hit this server block
    return 301 https://www.redacted--hostname.com$request_uri; 
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name www.redactedhostname.com;

    root /var/www/redactedhostname.com;

    ssl_certificate certs/redactedhostname.com.crt;
    ssl_certificate_key certs/redactedhostname.com.key;

    # restricted ciphers to support http2
    ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;

    # ...
}

curl the redirect server block

$ curl -I https://redactedhostname.com
HTTP/2 301
server: nginx
date: Fri, 02 Aug 2019 15:53:01 GMT
content-type: text/html
content-length: 178
location: https://www.redacted--hostname.com/

Note the response is HTTP/2 even though we are hitting the first server block (we know for sure we are hitting the first server block because of the -- in the redirect (location header).

I would expect this response to be HTTP 1.1 since http2 is not configured for this server block.

Bug or feature?

Change History (1)

comment:1 Changed 4 months ago by pluknet

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #1623.

Note: See TracTickets for help on using tickets.