nginx-proxy-manager icon indicating copy to clipboard operation
nginx-proxy-manager copied to clipboard

Fixing "the map directive is not allowed here" at the validation stage

Open derqurps opened this issue 1 year ago • 4 comments

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.

derqurps avatar Jan 19 '24 20:01 derqurps

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).

derqurps avatar Jan 19 '24 20:01 derqurps

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 :-)

af9 avatar Jan 28 '24 08:01 af9

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

s0mm3rb avatar Feb 03 '24 23:02 s0mm3rb

This PR fixed mine as well.

annahri avatar Feb 07 '24 03:02 annahri

Fixed for me too. Thanks @derqurps.

coytar avatar Feb 07 '24 18:02 coytar

image jc21/nginx-proxy-manager:github-pr-3478 working.

nmartinho avatar Feb 08 '24 15:02 nmartinho

Bumping for visibility. I am seeing the same bug on the Truenas SCALE app. Which is on v2.11.1.

abcummins33 avatar Feb 14 '24 16:02 abcummins33

Bump. I will try the pr version.

kevpen avatar Feb 17 '24 01:02 kevpen

just wanted to add to the confirmations that jc21/nginx-proxy-manager:github-pr-3478 i.e. this PR fixes the issue for me

Gronsak avatar Feb 22 '24 13:02 Gronsak

I also confirm removing the include fixed path forwarding

ilnytskyi avatar Feb 22 '24 17:02 ilnytskyi

Thanks for fixing. Just need a conflict fixed and then I'll merge.

jc21 avatar Feb 27 '24 01:02 jc21

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! 🙂

davidindra avatar Feb 27 '24 09:02 davidindra

When will it be available in a new release ?

mderaspe avatar Feb 27 '24 18:02 mderaspe

Same problem on latest, (JUst now) can confirm that : jc21/nginx-proxy-manager:github-pr-3478 Fixed it

casperse avatar Feb 28 '24 17:02 casperse

dear @davidindra This PR resolved my issue. But the latest release faces the same issue yet. When does a new release contain this one?

mostafabarmshory avatar Feb 29 '24 05:02 mostafabarmshory

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 :)

davidindra avatar Feb 29 '24 23:02 davidindra

Dear @davidindra Sorry, It`s my mistake. And tx for your feedback. Hope @jc21 makes a new release soon.

mostafabarmshory avatar Mar 01 '24 16:03 mostafabarmshory

thx for pr 3581 and 3478 fix my location problem

Cryxto avatar Mar 03 '24 03:03 Cryxto

Are the fixes in the latest release? Want to rid of the working PR Thanks!

Bodo-von-Greif avatar Apr 05 '24 09:04 Bodo-von-Greif

pls push this to release

Nazgile94 avatar Apr 06 '24 11:04 Nazgile94

pls push this to release

HTensor avatar Apr 09 '24 16:04 HTensor

Has this been pushed to release already?

MeesJ avatar Apr 17 '24 19:04 MeesJ

Yes please write in this thread when its alright to stop using: :-) jc21/nginx-proxy-manager:github-pr-3478

casperse avatar Apr 18 '24 10:04 casperse

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: Screenshot 2024-05-03 033836 Screenshot 2024-05-03 033854

Fix for this is now available (v. 2.11.2)👍

teambvd avatar May 03 '24 08:05 teambvd

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.

Joulinar avatar May 03 '24 19:05 Joulinar

anyone can confirm that this is fixed?

Nazgile94 avatar May 21 '24 14:05 Nazgile94

is fixed

eikaramba avatar May 21 '24 18:05 eikaramba