Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After port mapping is done through the firewall the access URL will hide the port number #1477

Closed
wsczx opened this issue Oct 11, 2021 · 1 comment

Comments

@wsczx
Copy link

wsczx commented Oct 11, 2021

After the internal network uses npm to do port mapping through the firewall, the access url will hide the port number, resulting in normal access. After testing, you need to modify the /etc/nginx/conf.d/include/proxy.conf file in the container!

Original configuration file:

add_header X-Served-By $host;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass $forward_scheme://$server:$port;

Need to be modified to:

add_header X-Served-By $host;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass $forward_scheme://$server:$port;

But every time you update the version, you need to enter the container to modify it. Is there a way to directly make the initial default value of proxy_set_header Host $http_host; instead of proxy_set_header Host $host; without recompiling the container?

@chaptergy
Copy link
Collaborator

I don't understand why you have to change $host to $http_host, is this something which would have to be changed in general or just for your specific configuration?

But you can mount a custom your own /etc/nginx/conf.d/include/proxy.conf into the container which will then overwrite the existing file inside the container.

version: '3'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    ...
    volumes:
      ...
      - /path/to/custom/proxy.conf:/etc/nginx/conf.d/include/proxy.conf
...

Though the file has not changed in almost a year, please note that you will also overwrite any updates to this file, so you should have an eye on whether new versions change anything in this file. At least you should keep in mind you overwrite this file if you encounter any problems after updating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants