http2 error: Invalid HTTP header field was received:

Johnatan Hallman johnatan-ftm at protonmail.com
Tue May 23 14:51:02 UTC 2023


Hello List,

I have a setup where I put an ancient host running a perl-cgi app behind an nginx reverse proxy.

The http reverse proxy works fine however if I try:

curl -v --anyauth -k  https://app.test.lan/cgi-bin/page.pl

I get:

http2 error: Invalid HTTP header field was received: frame type: 1, stream: 3, name: [defined(%hash) is deprecated at page.pl line 14.], value: []

However if I define http1.1 it works fine:

curl -v --http1.1 --anyauth -k  https://app.test.lan/cgi-bin/page.pl

I guess all modern browsers default to http2 these days so that I can specify it for curl is not a big help. I need this to work out of the box.

I have read that Nginx with the listen       443 ssl http2; directive will downgrade the connection to http1.1 automatically if it's negotiated... otherwise my previous test wouldn't work at all.

What I have tried is adding this version directive into the location:

        location / {
                proxy_pass http://10.9.0.90/;
                proxy_http_version 1.1;
        }

Makes no difference. Any idea how to fix this without touching the original app or the original webserver.

Thanks


More information about the nginx mailing list