I am having an issue with trying to point to a specific path for a specific uri. Whenever I am using my LAN IP as the Host or when using the domain name, I wish for my specific path to be served over HTTPS.
Notably, I am trying to do an exact match on the /admin uri. However I keep receiving redirects when on port 80 (despite defining an exact match on line 18). When trying to access over port 443, I keep receiving a 404 response (despite defining an exact match on line 320).
I do have several other services running which may or may not be setup correctly, however this is the main issue I am trying to resolve at this time.
Just to be clear, do you expect the /admin to be served over HTTP or do you expect it to be redirected to HTTPS? If you want to have it server over HTTP, the return directive can cause interesting behaviors in location blocks at times. Can you try moving the location / block below the other location blocks in that specific server block?
For the second part, are you seeing this behavior when hitting the /admin URI over HTTPS with the host IP and DNS name? When just using the IP, nginx will leverage the “first” server with HTTPS listeners, which probably would not be the one you expect. With the DNS name, the config looks OK so I am not sure why it is not matching the /admin location. Is there anything in the access log that could help? I assume the paths for the root and basic auth files are correct and have the correct privileges, so my best guess is that the request is getting caught either by the wrong location block or server configuration.