Skip to content

Commit

Permalink
Don't block requests coming from localhost. We want our cron cURL job…
Browse files Browse the repository at this point in the history
…s to still work.
  • Loading branch information
dale-c-anderson committed Feb 22, 2020
1 parent c46939d commit 40383fe
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions templates/etc/nginx/conf.d/deny-anonymous.conf.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# {{ ansible_managed }}
# Keep search engines out of all sites on the server.
# To disable for a specific site or location block, add "auth_basic off;" to your config.
auth_basic "{{ nginx_auth_basic_realm }}";
# Require basic auth to keep snoopy search engines out of all sites on the server,
# adding an exception map so we don't block requests originating from localhost. We want our cron cURL jobs to still work.
# To disable basic auth for a specific site or location block, add "auth_basic off;" to your config.

map $remote_addr $auth_basic_flag {
"127.0.0.1" "off";
default "{{ nginx_auth_basic_realm }}";
}

auth_basic $auth_basic_flag;
auth_basic_user_file {{ nginx_auth_basic_db_path }};

0 comments on commit 40383fe

Please sign in to comment.