Skip to content

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

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

Closed
wants to merge 1 commit into from

Conversation

derqurps
Copy link

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
Copy link
Author

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 derqurps changed the title Fixing the map directive is not allowed here at the validation stage Fixing "the map directive is not allowed here" at the validation stage Jan 25, 2024
@nginxproxymanagerci
Copy link

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.

@af9
Copy link

af9 commented Jan 28, 2024

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

@s0mm3rb
Copy link

s0mm3rb commented Feb 3, 2024

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

@annahri
Copy link

annahri commented Feb 7, 2024

This PR fixed mine as well.

@coytar
Copy link

coytar commented Feb 7, 2024

Fixed for me too. Thanks @derqurps.

@nmartinho
Copy link

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

@abcummins33
Copy link

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

@kevpen
Copy link

kevpen commented Feb 17, 2024

Bump. I will try the pr version.

@Gronsak
Copy link

Gronsak commented Feb 22, 2024

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

@ilnytskyi
Copy link

I also confirm removing the include fixed path forwarding

davidindra added a commit to davidindra/nginx-proxy-manager that referenced this pull request Feb 26, 2024
@jc21
Copy link
Member

jc21 commented Feb 27, 2024

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

@davidindra
Copy link
Contributor

This PR can be closed, as the only change was already merged into develop 10ece35 from PR #3581. Thank you all! 🙂

@derqurps derqurps closed this Feb 27, 2024
@mderaspe
Copy link

When will it be available in a new release ?

@casperse
Copy link

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

@mostafabarmshory
Copy link

mostafabarmshory commented Feb 29, 2024

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

@davidindra
Copy link
Contributor

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

@mostafabarmshory
Copy link

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

@Cryxto
Copy link

Cryxto commented Mar 3, 2024

thx for pr 3581 and 3478 fix my location problem

@Bodo-von-Greif
Copy link

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

@Nazgile94
Copy link

pls push this to release

1 similar comment
@HTensor
Copy link

HTensor commented Apr 9, 2024

pls push this to release

@MeesJ
Copy link

MeesJ commented Apr 17, 2024

Has this been pushed to release already?

@casperse
Copy link

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

@teambvd
Copy link

teambvd commented May 3, 2024

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

@Joulinar
Copy link

Joulinar commented May 3, 2024

btw: issue has been fixed on v2.11.2 via #3581

At least on my system I can create custom location without any workaround needed.

@Nazgile94
Copy link

anyone can confirm that this is fixed?

@eikaramba
Copy link

is fixed

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.