nginx-proxy-manager
nginx-proxy-manager copied to clipboard
Fixing "the map directive is not allowed here" at the validation stage
TLDR:
The map directive is only allowed in the http context. See https://nginx.org/en/docs/http/ngx_http_map_module.html
Longer Description:
This map block was introduced in this commit
If the code in _hsts_map.conf is included in the _location.conf, it will be rendered inside of the server context, which produces an error at the nginx validation stage. This is because the map directive is only allowed in the http context.
I used the docker version nginx-proxy-manager:latest (a3a54016e85f)
To get to the fail (Offline) state:
- add a proxy host
- add a certificate and activate HSTS
- add a custom location
- save
Now the new proxy-host should fail and be offline.
Also i'm not sure if including the map block _hsts_map.conf in the templates is the best idea. It will be added mutiple times to the http context (before each https enabled server block), and sets each time the same variable ($hsts_header).
Docker Image for build 2 is available on DockerHub as jc21/nginx-proxy-manager:github-pr-3478
Note: ensure you backup your NPM instance before testing this PR image! Especially if this PR contains database changes.
I had same issue with one of my proxy-hosts. I did not use HSTS but I use custom locations and some advanced settings. So the host went offline and I got nginx proxy map directive is not allowed here in the log.
After changing to image jc21/nginx-proxy-manager:github-pr-3478 everything works perfect. Up to now, I don't see any side-effects. Thx :-)
same issue with or without HSTS when using the server authentication for subdomains
I use a custom location to authenticate against organizr for my subdomains for example: Organizr documentation
using jc21/nginx-proxy-manager:github-pr-3478 fixed it
thanks
This PR fixed mine as well.
Fixed for me too. Thanks @derqurps.
image jc21/nginx-proxy-manager:github-pr-3478 working.
Bumping for visibility. I am seeing the same bug on the Truenas SCALE app. Which is on v2.11.1.
Bump. I will try the pr version.
just wanted to add to the confirmations that jc21/nginx-proxy-manager:github-pr-3478 i.e. this PR fixes the issue for me
I also confirm removing the include fixed path forwarding
Thanks for fixing. Just need a conflict fixed and then I'll merge.
This PR can be closed, as the only change was already merged into develop https://github.com/NginxProxyManager/nginx-proxy-manager/commit/10ece3548d42aa5dba424816f065827fdaf3f990 from PR https://github.com/NginxProxyManager/nginx-proxy-manager/pull/3581. Thank you all! 🙂
When will it be available in a new release ?
Same problem on latest, (JUst now) can confirm that : jc21/nginx-proxy-manager:github-pr-3478 Fixed it
dear @davidindra This PR resolved my issue. But the latest release faces the same issue yet. When does a new release contain this one?
Hi @mostafabarmshory, I am not the maintainer of this project, @jc21 is, so I do not know when new release will happen. Until then, you can use Docker tag jc21/nginx-proxy-manager:github-pr-3581 containing this fix and also the fix about max count of domains in proxy host :)
Dear @davidindra Sorry, It`s my mistake. And tx for your feedback. Hope @jc21 makes a new release soon.
thx for pr 3581 and 3478 fix my location problem
Are the fixes in the latest release? Want to rid of the working PR Thanks!
pls push this to release
pls push this to release
Has this been pushed to release already?
Yes please write in this thread when its alright to stop using: :-) jc21/nginx-proxy-manager:github-pr-3478
Just mentioning here for those who might not know - you can be notified (via email, or push notification if you install the mobile app) regarding fix availability by choosing to 'watch' the repo, selecting to be notified only of new releases:
Fix for this is now available (v. 2.11.2)👍
btw: issue has been fixed on v2.11.2 via https://github.com/NginxProxyManager/nginx-proxy-manager/pull/3581
At least on my system I can create custom location without any workaround needed.
anyone can confirm that this is fixed?
is fixed