Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable http2 in nginx

due to this Safari Issue with HTTP/2 and Form POSTS I wanted to disable serving one Webpage via HTTP/2. So I just removed the "http2" from the server_name directive in corresponding nginx server block.

server {
  listen x.x.x.x:443 ssl;
  server_name xxxx;
  [...]
}

But after I restarted NginX and opened the website in various browsers the HTTP/2 Protocol is still used... What am I doing wrong?

My NginX version is 1.10.1

Greets Jan

like image 920
Jan Tchärmän Avatar asked Sep 12 '16 14:09

Jan Tchärmän


People also ask

How do I disable HTTP2 in Safari?

In some cases, this may not occur. If you are seeing the behavior on iOS or Safari devices, disable the Enhanced HTTP/2 Prioritization feature under the Speed app > Optimization tab.


2 Answers

Someone answered with the correct solution here, but the post disappeared...

You have to disable http2 for all server blocks on one IP Adress / Port. If there is one server block configured to enable http2 it is enabled for all server blocks on this IP.

like image 164
Jan Tchärmän Avatar answered Sep 17 '22 01:09

Jan Tchärmän


NGINX can't serve multiple protocol on 1 port. Make it different port. Example : HTTP/2 on port 443

server {
  listen x.x.x.x:443 ssl http2;
  server_name xxxx;
  [...]
}

and then HTTP 1.1 on port 444

 server {
      listen x.x.x.x:444 ssl;
      server_name xxxx;
      [...]
    }

or if you wanna disable http/2 module, re-install NGINX without --with-http_v2_module

like image 45
Ariq Naufal Avatar answered Sep 17 '22 01:09

Ariq Naufal