NginxProxyManager / nginx-proxy-manager

Docker container for managing Nginx proxy hosts with a simple, powerful interface
https://nginxproxymanager.com
MIT License
22.25k stars 2.57k forks source link

Basic Authentication not working correctly on Proxy Hosts with custom locations #2246

Open PlasmaSoftUK opened 2 years ago

PlasmaSoftUK commented 2 years ago

Checklist

Describe the bug I have built a Proxy Host which has a dns name, a valid SSL cert from LetsEncrypt using the latest Docker image.

I have added an Access list with Basic HTTP auth to this proxy, along with some custom locations:

/ ==> http://10.0.0.2:8181/ /radarr ==> http://10.0.0.2:7878/ /sonar ==> http://10.0.0.2:8989/ /nzbget ==> http://10.0.0.2:6789/

When accessing the default '/' location via https://my-dns-name.com/ I am presented with the basic auth login screen and it works as expected, if I authenticate and login I get to the page if I hit cancel, I get nothing.

When accessing any of the custom locations via https://my-dns-name.com/sonarr or https://my-dns-name.com/radarr the page loads in the background before the Auth is passed, and the login box is present over the top. if I hit cancel I can still browse the page just like I should be able to AFTER authentication.

Hitting Cancel on Basic Authentication dialog for custom locations (except '/') skips Auth and allows access to the page.

Nginx Proxy Manager Version v2.9.18

To Reproduce Steps to reproduce the behavior:

  1. Create custom locations with basic auth
  2. Browse to a custom location and choose cancel when the auth dialog is presented
  3. Page will be displayed, and it should not be.

Expected behavior Page should NOT load in the background and when hitting Cancel on the Auth dialog the page should not be loaded. I would expect a blank page or a default auth failed page.

Screenshots

Operating System running under MacOS Monterey, and Docker version 20.10.12, build e91ed57

PlasmaSoftUK commented 2 years ago

So I've switched to another device, auth looks to be working as expected on a device that hasn't been used before. But on a device that is authenticated when it loads the custom locations, they load in the background but it still shows the Basic Auth Login box. At this point the page is loaded, I assume because the users is authenticated, so ....... either the page shouldn't load, or the login box shouldn't be displayed? There is definitely something not right here, unless I'm missing something in the custom locations config.

Vanillabacke commented 1 year ago

I can confirm that issue with v2.9.19. As soon as I add an location to the nginx config, it will stop working. It looks like this will not be added, if there will be a defined location in the backend. I checking the config in /data/nginx/proxy_host after each changes to confirm that.

For those who have the same issue, here is a workaround:

In my example I used Satisfy Any without Pass Auth to Host. If you have different settings you can find the generated config in your mounted /data-volume:

github-actions[bot] commented 7 months ago

Issue is now considered stale. If you want to keep it open, please comment :+1: