Host header sent to proxied server using different port
November 11, 2021 10:04AM

If I have a simple reverse proxy configuration e.g.

server {
listen 80 default_server;
server_name myserver;

proxy_set_header Host $host;

location /blueprint/servlet/ {
proxy_pass http://backendserver:40980/blueprint/servlet/;

then the Host header sent to the backendserver is not what I would expect. It does not send (what I would like it to send)

Host: myserver

but instead it sends

Host: myserver:40980

and there seems to be no way around it. Even if I explicitly specify a port in proxy_set_header Host then it's always setting the port where proxy_pass is making the request to, and not the port specified in proxy_set_header.

Is there any way around this?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 46
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready