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

move advanced_config section of /app/templates/_location.conf to top of default config #3729

Merged
merged 1 commit into from
May 20, 2024

Conversation

clhey
Copy link
Contributor

@clhey clhey commented Apr 28, 2024

I found that custom configurations cannot override the default configurations because nginx prioritizes the configurations appearing earlier. Therefore, I moved the advanced_config section of /app/templates/_location.conf to top of default config。

config:
image

before nginx proxy file:
image

after nginx proxy file:
image

see this issue:
#2675 (comment)

@nginxproxymanagerci
Copy link

Docker Image for build 1 is available on DockerHub as jc21/nginx-proxy-manager:github-pr-3729

Note: ensure you backup your NPM instance before testing this PR image! Especially if this PR contains database changes.

@jc21 jc21 merged commit 3754a56 into NginxProxyManager:develop May 20, 2024
1 check passed
@whc2001
Copy link

whc2001 commented Jul 21, 2024

Are you sure that the config entry on the top will take precedence in Nginx? I have tried myself and the result is the opposite.

image

image

The line where the red arrow points to has proxy_set_header Host $host; originally, and I was not able to get my override config of $http_host work until I manually delete the auto generated line below.

@Erzbir
Copy link

Erzbir commented Aug 20, 2024

Why do that? It is no work well if I want set Host header. The nginx will accept the last one, I want to override some configs

whc2001 added a commit to whc2001/nginx-proxy-manager that referenced this pull request Oct 21, 2024
@dgm
Copy link

dgm commented Jan 7, 2025

Unfortunately, @Erzbir , It seems to me that I get an error with two line lines setting the Host header, no matter which order they are. I have to delete the $host one by hand in order to override the Host header in a custom location.

Why would someone do this?

Server A hosts a mail program, and server B embeds it under b/mail/ ...
Or maybe you are in the process of migrating a service and need to intercept a partial path and send it somewhere else ...

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

Successfully merging this pull request may close these issues.

5 participants