[GH-ISSUE #1483] proxy_set_header X-Forwarded-Host in advance configuration doesn't take effect #1139

Closed
opened 2026-02-26 06:35:55 +03:00 by kerem · 5 comments
Owner

Originally created by @awsong on GitHub (Oct 14, 2021).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1483

Checklist

  • Have you pulled and found the error with jc21/nginx-proxy-manager:latest docker image?
    • Yes
  • Are you sure you're not using someone else's docker image?
    • Yes
  • Have you searched for similar issues (both open and closed)?
    • Yes

Describe the bug

I found that if I put
proxy_set_header X-Forwarded-Host $http_host
in my advance config it doesn't take effect. After looking at the saved config file I found that the statement is put outside of the location block. If I manually move the statement into location block it works fine.

I also checked Custom Nginx Configurations section in the documentation, it seems that there is no option to let me customize inside location block.

image
image

Nginx Proxy Manager Version

2.9.9

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

Screenshots

Operating System

Additional context

Originally created by @awsong on GitHub (Oct 14, 2021). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1483 <!-- Are you in the right place? - If you are looking for support on how to get your upstream server forwarding, please consider asking the community on Reddit. - If you are writing code changes to contribute and need to ask about the internals of the software, Gitter is the best place to ask. - If you think you found a bug with NPM (not Nginx, or your upstream server or MySql) then you are in the *right place.* --> **Checklist** - Have you pulled and found the error with `jc21/nginx-proxy-manager:latest` docker image? - Yes - Are you sure you're not using someone else's docker image? - Yes - Have you searched for similar issues (both open and closed)? - Yes **Describe the bug** <!-- A clear and concise description of what the bug is. --> I found that if I put `proxy_set_header X-Forwarded-Host $http_host` in my advance config it doesn't take effect. After looking at the saved config file I found that the statement is put outside of the `location` block. If I manually move the statement into `location` block it works fine. I also checked Custom Nginx Configurations section in the documentation, it seems that there is no option to let me customize inside `location` block. ![image](https://user-images.githubusercontent.com/787544/137233932-5b0b0464-ef18-4199-b3b6-bbc27b4a5339.png) ![image](https://user-images.githubusercontent.com/787544/137233978-ed85fd00-b3ff-4a3c-9007-df285c4728b0.png) **Nginx Proxy Manager Version** <!-- What version of Nginx Proxy Manager is reported on the login page? --> 2.9.9 **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected behavior** <!-- A clear and concise description of what you expected to happen. --> **Screenshots** <!-- If applicable, add screenshots to help explain your problem. --> **Operating System** <!-- Please specify if using a Rpi, Mac, orchestration tool or any other setups that might affect the reproduction of this error. --> **Additional context** <!-- Add any other context about the problem here, docker version, browser version, logs if applicable to the problem. Too much info is better than too little. -->
kerem 2026-02-26 06:35:55 +03:00
Author
Owner

@chaptergy commented on GitHub (Oct 14, 2021):

Yeah, that's how the advanced config works. I think there is some weird behavior in nginx where it doesn't apply any headers from outside the location block if there is even a single header set inside the location block. However you should be able to add a custom location / where you can duplicate the stuff you need and add your custom header.

<!-- gh-comment-id:943218386 --> @chaptergy commented on GitHub (Oct 14, 2021): Yeah, that's how the advanced config works. I think there is some weird behavior in nginx where it doesn't apply any headers from outside the location block if there is even a single header set inside the location block. However you should be able to add a custom location `/` where you can duplicate the stuff you need and add your custom header.
Author
Owner

@awsong commented on GitHub (Oct 14, 2021):

Yes you are right. I can add custom locate / in the settings and it works fine.

<!-- gh-comment-id:943284639 --> @awsong commented on GitHub (Oct 14, 2021): Yes you are right. I can add custom locate / in the settings and it works fine.
Author
Owner

@denppa commented on GitHub (Nov 4, 2021):

Yes you are right. I can add custom locate / in the settings and it works fine.

Would you mind letting me know how to do it?

I want to access it at / and putting the lines at with that in mind, forwarded to the same ip and the parent proxy host does not solve the problem for me. Can I see what you did?

<!-- gh-comment-id:960352699 --> @denppa commented on GitHub (Nov 4, 2021): > Yes you are right. I can add custom locate / in the settings and it works fine. Would you mind letting me know how to do it? I want to access it at / and putting the lines at with that in mind, forwarded to the same ip and the parent proxy host does not solve the problem for me. Can I see what you did?
Author
Owner

@awsong commented on GitHub (Nov 4, 2021):

Yes you are right. I can add custom locate / in the settings and it works fine.

Would you mind letting me know how to do it?

I want to access it at / and putting the lines at with that in mind, forwarded to the same ip and the parent proxy host does not solve the problem for me. Can I see what you did?

Here is how I did it:
image

<!-- gh-comment-id:960478581 --> @awsong commented on GitHub (Nov 4, 2021): > > Yes you are right. I can add custom locate / in the settings and it works fine. > > Would you mind letting me know how to do it? > > I want to access it at / and putting the lines at with that in mind, forwarded to the same ip and the parent proxy host does not solve the problem for me. Can I see what you did? Here is how I did it: ![image](https://user-images.githubusercontent.com/787544/140264958-766d2ae3-3243-4663-8edc-3a5541e06bb2.png)
Author
Owner

@denppa commented on GitHub (Nov 4, 2021):

Yes you are right. I can add custom locate / in the settings and it works fine.

Would you mind letting me know how to do it?
I want to access it at / and putting the lines at with that in mind, forwarded to the same ip and the parent proxy host does not solve the problem for me. Can I see what you did?

Here is how I did it: image

Thank you, but apparently, my apps worked without needing to insert these but only enabling websocket. Not a professional so don't know the difference except a few lines being added. But if I do need some custom lines I will be sure to add them that way in the future.

Thank you so much!

<!-- gh-comment-id:961259723 --> @denppa commented on GitHub (Nov 4, 2021): > > > > > Yes you are right. I can add custom locate / in the settings and it works fine. > > > > > > Would you mind letting me know how to do it? > > I want to access it at / and putting the lines at with that in mind, forwarded to the same ip and the parent proxy host does not solve the problem for me. Can I see what you did? > > Here is how I did it: ![image](https://user-images.githubusercontent.com/787544/140264958-766d2ae3-3243-4663-8edc-3a5541e06bb2.png) Thank you, but apparently, my apps worked without needing to insert these but only enabling websocket. Not a professional so don't know the difference except a few lines being added. But if I do need some custom lines I will be sure to add them that way in the future. Thank you so much!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#1139
No description provided.