0
How to add exceptions to basic authentication with nginx
Creat
09/12/2011 18:38:04
per
Roger Campos
In staging environments of our websites we usually want to make everything private, but then external calls to our app, as for example paypal IPN calls, won't be able to reach us.
The solution is a simple nginx configuration:
server {
listen 80;
server_name staging.myapp.com;
root /my_app_path/current/public;
location / {
auth_basic "Restricted";
auth_basic_user_file basic_auths/pwd_file;
passenger_enabled on;
rails_env staging;
}
location /paypal_ipn {
auth_basic off;
passenger_enabled on;
rails_env staging;
}
}
This will hide everything behind the basic authenticated realm except for the /paypal_ipn url.