[GH-ISSUE #202] Access-Control-Allow-Origin on the default location "/" #176

Closed
opened 2026-02-26 06:31:09 +03:00 by kerem · 4 comments
Owner

Originally created by @Appyx on GitHub (Sep 22, 2019).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/202

I want to modify the header Access-Control-Allow-Origin on the default location "/". But this is not possible without entering the global context and thus, the "deeper" location context is used, making my modification useless.
At least I guess that's the problem.

I tried adding the following in the Advanced section:

add_header 'Access-Control-Allow-Origin' '*' always;

Is there a trick to allow cross domain requests?

Edit:
I found the trick :)
I added the header as a custom location at path "/" that targets the same server.
However, this feels really "hacky".

Edit2:
It would be cool to have a GUI option for embedding the server as an iFrame without touching the advanced section as well as having an option for CORS.

Originally created by @Appyx on GitHub (Sep 22, 2019). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/202 I want to modify the header Access-Control-Allow-Origin on the default location "/". But this is not possible without entering the global context and thus, the "deeper" location context is used, making my modification useless. At least I guess that's the problem. I tried adding the following in the Advanced section: `add_header 'Access-Control-Allow-Origin' '*' always;` Is there a trick to allow cross domain requests? Edit: I found the trick :) I added the header as a custom location at path "/" that targets the same server. However, this feels really "hacky". Edit2: It would be cool to have a GUI option for embedding the server as an iFrame without touching the advanced section as well as having an option for CORS.
kerem 2026-02-26 06:31:09 +03:00
Author
Owner

@sign0 commented on GitHub (Sep 7, 2020):

Unfortunately using location / { ... } seems to "break" the auth_basic (configured from GUI)

<!-- gh-comment-id:688388953 --> @sign0 commented on GitHub (Sep 7, 2020): Unfortunately using `location / { ... }` seems to "break" the auth_basic (configured from GUI)
Author
Owner

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

As this issue is resolved (using the / location block, which is not a hacky way around things but the suggested option) I'll close it. For a feature request of having a dedicated GUI option, see https://github.com/jc21/nginx-proxy-manager/issues/379.

<!-- gh-comment-id:950948727 --> @chaptergy commented on GitHub (Oct 25, 2021): As this issue is resolved (using the `/` location block, which is not a hacky way around things but the suggested option) I'll close it. For a feature request of having a dedicated GUI option, see https://github.com/jc21/nginx-proxy-manager/issues/379.
Author
Owner

@meichthys commented on GitHub (Feb 3, 2022):

If anyone has this working, could you please provide a screenshot?

<!-- gh-comment-id:1029075282 --> @meichthys commented on GitHub (Feb 3, 2022): If anyone has this working, could you please provide a screenshot?
Author
Owner

@Codename-11 commented on GitHub (Jun 17, 2022):

After a lot of digging around and attempts at using the "Advanced" tab to add add_header 'Access-Control-Allow-Origin' '*';, to no avail, I finally attempted adding a custom location under the host, which finally worked!

This was all in the effort of having my Homer dashboard be able to display statistics from Uptime-Kuma, but I kept getting the error that the Access-Control-Allow-Origin was not set on the remote resource. I thought doing so under the Advanced tab would do the trick but that wasn't the case it seems. It immediately worked after setting it up under custom locations. Hopefully this helps someone!

image

<!-- gh-comment-id:1159104443 --> @Codename-11 commented on GitHub (Jun 17, 2022): After a lot of digging around and attempts at using the "Advanced" tab to add `add_header 'Access-Control-Allow-Origin' '*';`, to no avail, I finally attempted adding a custom location under the host, which finally worked! This was all in the effort of having my Homer dashboard be able to display statistics from Uptime-Kuma, but I kept getting the error that the Access-Control-Allow-Origin was not set on the remote resource. I thought doing so under the Advanced tab would do the trick but that wasn't the case it seems. It immediately worked after setting it up under custom locations. Hopefully this helps someone! ![image](https://user-images.githubusercontent.com/10284999/174350813-701451fc-98c2-4592-a488-9dafc7ef5aac.png)
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#176
No description provided.