Nginx authentication, excluding those specified on the local network

Coming from apache2 is one feature that I cannot achieve; authentication is required only for external access, but free access to users on my local network. Any ideas how easy it is to deal with this scenario?

Any help would be appreciated.

+5
source share
1 answer

I deleted my previous answer and would like to suggest a solution that I provided below

I did a little search and found a solution to your problem. In the code where you use the directive auth_basic, make the following changes :

satisfy    any;
allow      10.0.0.1/8;   // give access for all internal request
deny       all;
auth_basic "....";        // your auth_basic code goes here
auth_basic_user_file ...; // your auth_basic_user_file goes here

? " satisfy , any all . :

;)

+5

All Articles