Skip to content

Instantly share code, notes, and snippets.

@xralphack
Created July 14, 2016 09:33
Show Gist options
  • Save xralphack/9931339b4443ef1aab31486bdd82d358 to your computer and use it in GitHub Desktop.
Save xralphack/9931339b4443ef1aab31486bdd82d358 to your computer and use it in GitHub Desktop.
Force auth in nginx except for facebooks crawler.
server{
satisfy any;
# https://developers.facebook.com/docs/ApplicationSecurity/#facebook_scraper
allow 31.13.24.0/21;
allow 31.13.64.0/18;
allow 66.220.144.0/20;
allow 69.63.176.0/20;
allow 69.171.224.0/19;
allow 74.119.76.0/22;
allow 103.4.96.0/22;
allow 173.252.64.0/18;
allow 204.15.20.0/22;
allow 2401:db00::/32;
allow 2620:0:1c00::/40;
allow 2a03:2880::/32;
deny all;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
# ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment