Created
May 21, 2021 13:01
-
-
Save fransallen/d7a8fcda140d37b7eb6045e8f99d28a3 to your computer and use it in GitHub Desktop.
An nginx configuration to block referers except valid ones.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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