Skip to content

Instantly share code, notes, and snippets.

@fransallen
Created May 21, 2021 13:01
Show Gist options
  • Save fransallen/d7a8fcda140d37b7eb6045e8f99d28a3 to your computer and use it in GitHub Desktop.
Save fransallen/d7a8fcda140d37b7eb6045e8f99d28a3 to your computer and use it in GitHub Desktop.
An nginx configuration to block referers except valid ones.
server {
# https://nginx.org/en/docs/http/ngx_http_referer_module.html
valid_referers server_names *.example.com;
if ($invalid_referer) {
return 403;
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment