Skip to content

Instantly share code, notes, and snippets.

@dblackdblack
Last active May 31, 2017 03:33
Show Gist options
  • Save dblackdblack/8ee26ab2216cabe411143c349150e6b3 to your computer and use it in GitHub Desktop.
Save dblackdblack/8ee26ab2216cabe411143c349150e6b3 to your computer and use it in GitHub Desktop.
# https://superuser.com/a/1060873
map $http_x_forwarded_for $allowed {
default false;
~(^|,|\s)54.68.161.228$ true;
~(^|,|\s)10.200.\d+.\d+$ true;
"" true; # for internal-to-internal traffic, X-Forwarded-For is unset
}
server {
listen 80;
server_name localhost;
location / {
if ($allowed = false) {
return 403;
}
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment