Allow/Deny rules in Location block

Reinis Rozitis r at roze.lv
Mon Jan 23 12:38:30 UTC 2023


> I am trying to restrict some Location block in my Nginx configuration to 
> specific IPs. Below are the changes I made -
> 
>        location = /auth {
>              }
> 
> Here, the deny rule is not working. Users are still able to access the 
> page publicly. Am I missing something?

Are you sure that the request is exactly /auth since anything else like /auth/ or /auth/something will land in the first location block without any restrictions defined.
Try to remove the '=' and see if it works then.

rr


More information about the nginx mailing list