I'm a newcomer to nginx (been using apache in the past).
At the moment I'm trying to setup a cache which will front an apache backend, eventually I think (based on my, so far, good experience with nginx) that we will switch to just use nginx.
As soon as I turn on http2 Safari cannot get a response. In the error log there is nothing that indicates a problem and if I turn on the access log and check there I can see that the Safari client does many, many connections, it's like it just keeps refreshing the page.
I've tried numerous of nginx versions as I noticed that there might be a problem with the latest stable. So I tried downgrading to 1.9.14 as well as upgrading to 1.11.1, neither was any luck.
Nginx is compiled with just:
./configure --with-http_ssl_module --with-http_v2_module
Nginx -V output:
nginx version: nginx/1.11.1
built by gcc 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2.1)
built with OpenSSL 1.0.2g-fips 1 Mar 2016
TLS SNI support enabled
configure arguments: --with-http_ssl_module --with-http_v2_module
My config looks like this (my sites-available conf):
upstream backend {
server 127.0.0.1:8088 weight=100;
}
server {
listen 443 ssl http2 deferred;
server_name www.server.name;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK";
ssl_prefer_server_ciphers on;
ssl_certificate /path/to/cert.crt
ssl_certificate_key /path/to/cert_key.key
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded_For $proxy_add_x_forwarded_for;
proxy_pass https://backend;
}
}
If I remove http2 from the listen argument and restart it works fine...
I've search to find out if I'm doing anything wrong in my config but I cannot find anything... However, if there are some improvements to my config please let me know. The main problem however is that whenever I hit an URL (cached or not) with Safari it just keeps loading.
This is how my access log looks like after a request:
123.123.123.123 - - [11/Jun/2016:08:37:28 +0200] "GET /example/url HTTP/2.0" 200 15032 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17"
123.123.123.123 - - [11/Jun/2016:08:37:28 +0200] "GET /example/url HTTP/2.0" 200 15032 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17"
123.123.123.123 - - [11/Jun/2016:08:37:28 +0200] "GET /example/url HTTP/2.0" 200 15032 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17"
123.123.123.123 - - [11/Jun/2016:08:37:28 +0200] "GET /example/url HTTP/2.0" 200 15032 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17"
123.123.123.123 - - [11/Jun/2016:08:37:28 +0200] "GET /example/url HTTP/2.0" 200 15032 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17"
123.123.123.123 - - [11/Jun/2016:08:37:28 +0200] "GET /example/url HTTP/2.0" 200 15032 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17"
123.123.123.123 - - [11/Jun/2016:08:37:28 +0200] "GET /example/url HTTP/2.0" 200 15032 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17"
Thanks!
Okey! After much research and testing it turned out that I needed to hide the Upgrade header in my config. proxy_hide_header Upgrade;
Read more here: https://trac.nginx.org/nginx/ticket/915