Web Development
Web Development

Fix HTTP2 Header Errors on Nginx Reverse Proxy


You might get an HTTP2 error from curl and Safari browsers even though the page loads fine on Chrome and Firefox.


curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
Safari Can't Open the Page
Safari can't open the page "https://steve.zazeski.com/". The error is: "cannot parse response" (NSURLErrorDomain:-1017)

The issue is the backing service is offering to upgrade an HTTP1 connection but the reverse proxy is using an HTTP2 connection to the actual client. If either the backing service does not offer to upgrade the connection or the proxy removes this header, then this error will go away.

If you use Nginx reverse proxy manager, in the edit proxy host dialog you can add

proxy_hide_header Upgrade;

If you are running standard Nginx:

server {
    listen 80;
    server_name example.com;

    location / {
       proxy_pass http://127.0.0.1:8080;
       proxy_hide_header Upgrade;
    }
}

I'm a 33 year old UIUC Computer Engineer building mobile apps, websites and hardware integrations with an interest in 3D printing, biotechnology and Arduinos.

View Comments
There are currently no comments.

This site uses Akismet to reduce spam. Learn how your comment data is processed.