Issue with NGINX and proxy: HTTP/1.1 505 HTTP Version not supported

Moshe Katz kohenkatz at gmail.com
Fri Mar 6 18:15:11 UTC 2020


It looks like HP has decided to only support HTTP 1.0 or HTTP 1.1 on this
printer, though it is not clear which one they are using since you didn't
show the headers of your request direct to the printer.

If you do `curl -v http://192.168.1.XX` it will show you the headers, which
include the HTTP version that was used.
It will be either 1.0 or 1.1.

You can then use the `proxy_http_version` directive like this (substitute
1.1 for 1.0 if needed) to force the version used:

server {
    listen 80;
    access_log /var/log/nginx/localhost.access_log main;
    error_log /var/log/nginx/localhost.error_log debug;

    location /printer/ {
        proxy_pass http://192.168.1.XX/;
        proxy_http_version 1.1;
    }
}


Moshe


On Fri, Mar 6, 2020 at 3:29 AM Willy Gardiol <willy at gardiol.org> wrote:

>
> Hi all!
> first time poster here so please excuse my manners and correct me where
> i am wrong.
>
> I use NGINX 1.16.1 on Gentoo as reverse proxy server to expose some
> services to an external web site.
>
> I am exposing many things but one is giving me headaches.
>
> I am trying to expose the web UI of an HP network printer.
>
> I have this in my nginx.conf (trimming lines to the ones relevant):
> server {
>                  listen 80;
>                  access_log /var/log/nginx/localhost.access_log main;
>                  error_log /var/log/nginx/localhost.error_log debug;
>
>                  location /printer/ {
>                          proxy_pass http://192.168.1.XX/;
>                  }
> }
>
> I can access the printer from the proxy server, no problems, with:
> curl http://192.168.1.XX
>
> But if i try, on the same proxy server this:
> curl http://127.0.0.1/printer/
>
> I get the error:
> 2020/03/06 08:42:02 [debug] 12870#0: *2 connect to 192.168.1.XX:80,
> fd:11 #3
> 2020/03/06 08:42:02 [debug] 12870#0: *2 http upstream connect: -2
> 2020/03/06 08:42:02 [debug] 12870#0: *2 http finalize request: -4,
> "/printer/?" a:1, c:2
> [snip]
> 2020/03/06 08:42:02 [debug] 12870#0: *2 http run request: "/printer/?"
> 2020/03/06 08:42:02 [debug] 12870#0: *2 http upstream check client,
> write event:1, "/printer/"
> 2020/03/06 08:42:02 [debug] 12870#0: *2 http upstream request:
> "/printer/?"
> 2020/03/06 08:42:02 [debug] 12870#0: *2 http upstream send request
> handler
> 2020/03/06 08:42:02 [debug] 12870#0: *2 http upstream send request
> 2020/03/06 08:42:02 [debug] 12870#0: *2 http upstream send request body
> [snip]
> 2020/03/06 08:42:02 [debug] 12870#0: *2 http upstream request:
> "/printer/?"
> 2020/03/06 08:42:02 [debug] 12870#0: *2 http upstream process header
> [snip]
> 2020/03/06 08:42:02 [debug] 12870#0: *2 http proxy status 505 "505 HTTP
> Version not supported"
> 2020/03/06 08:42:02 [debug] 12870#0: *2 http proxy header:
> "X-Content-Type-Options: no-sniff"
> 2020/03/06 08:42:02 [debug] 12870#0: *2 http proxy header:
> "Cache-Control: no-cache, no-store, must-revalidate"
> 2020/03/06 08:42:02 [debug] 12870#0: *2 http proxy header: "Server:
> gSOAP/2.7"
> 2020/03/06 08:42:02 [debug] 12870#0: *2 http proxy header:
> "Content-Length: 0"
> 2020/03/06 08:42:02 [debug] 12870#0: *2 http proxy header: "Connection:
> close"
> 2020/03/06 08:42:02 [debug] 12870#0: *2 http proxy header done
> 2020/03/06 08:42:02 [debug] 12870#0: *2 HTTP/1.1 505 HTTP Version not
> supported^M
>
> So my guess NGINX is doing something which the web printer does not
> like...
>
> What could i try or do?
>
> thank you for your time and response.
>
>
>
>
>
> --
> Willy Gardiol
> willy at gardiol.org
> www.gardiol.org
> www.trackaway.org -> Track YOUR way the way you want!
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20200306/c34358d7/attachment.htm>


More information about the nginx mailing list