Basic Auth only for external IPs and not localhost or LAN networks

Quintin Par quintinpar at
Wed Feb 15 04:33:13 UTC 2012

Hi all,

I have a location directive with basic auth in it.

        location / {

                   auth_basic "Admin Login";

                   auth_basic_user_file /etc/nginx/.htpasswd;

How do I specify a rule such that the basic auth is applied only to
external IPs and not to 127.0.0.x, 192.0.x & 10.0.x?

I run Jenkins from a sub-domain and my git post-commit-hook needs to hit a
URL under this location directive to trigger continuous integration. But
this Jenkins cannot handle basic auth that blocks the URL submit.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list