nginx-proxy-manager
nginx-proxy-manager copied to clipboard
Host should be $proxy_host, not $host
-
$host is the Host sent by the user's browser. This is the correct setting if the service has built-in support for being proxied.
-
$proxy_host is the Host as if the browser would run on the proxy. This is the correct setting if the service does not have built-in support for reverse proxies. It is also the nginx default.
-
In nginx, you cannot unset the Host header. Configuring headers multiple times just sends multiple values with the http request. So there is no way to "fix" the Host by adding a custom header if it is already set.
For these reasons, Host should not be set (and default to $proxy_host). In the unlikely case that your service needs something else you can then just set a custom Host header in the GUI.
Fixes https://github.com/NginxProxyManager/nginx-proxy-manager/issues/2675
PR is now considered stale. If you want to keep it open, please comment :+1:
How is this STILL not merged? Such a design flaw just obliterates all the usefulness this program brought. PLEASE MERGE THIS and let's have it fixed at last.
more_set_input_headers 'Host: www.domain-new.com';
Integerated nginx is openresty, that support "headers-more-nginx-module-0.37" modules.
so, you can reset the input header by command : more_set_input_headers
================
set input headers
location /foo { set $my_host 'my dog'; more_set_input_headers 'Host: $my_host'; more_set_input_headers -t 'text/plain' 'X-Foo: bah';
# now $host and $http_host have their new values...
# ...
}
more_set_input_headers 'Host: www.domain-new.com'; ... so, you can reset the input header by command : more_set_input_headers
Not sure I understand how more_set_input_headers helps here. It looks like any custom headers I write, including more_set_input_headers, will appear in the generated conf file before the generated proxy_set_header Host $host; line. So are you saying more_set_input_headers takes precedence over any proxy_set_header statements, even if it appears before such statements?
Docker Image for build 5 is available on DockerHub:
nginxproxymanager/nginx-proxy-manager-dev:pr-3247
[!NOTE] Ensure you backup your NPM instance before testing this image! Especially if there are database changes. This is a different docker image namespace than the official image.
[!WARNING] Changes and additions to DNS Providers require verification by at least 2 members of the community!