Skip to content
Snippets Groups Projects
Commit 40d6797f authored by Julien Schmidt's avatar Julien Schmidt
Browse files

nginx: use geo module instead of $remote_addr regexp

parent 192b7db7
No related branches found
No related tags found
No related merge requests found
geo $ssn {
default false;
# StuSta
10.150.0.0/17 true;
141.84.69.0/24 true;
2001:4ca0:200::/48 true;
# MB67
10.149.8.0/21 true;
129.187.166.156/30 true;
2001:4ca0:201::/48 true;
}
server {
listen 80;
listen [::]:80;
......@@ -18,10 +32,6 @@ server {
location /status {
default_type application/json;
set $ssn "true";
if ( $remote_addr !~ "^((10\.150\.[01]?\d?\d\..*)|(141\.84\.69\..*)|(10\.149\.0?([0-9]|1[0-5])\..*)|(129\.187\.166\.15[6-9])|(2001:4ca0:0?20[01]:.*)|(10\.0\..*))") {
set $ssn "false";
}
return 200 "{\"ip\": \"$remote_addr\", \"ssn\": $ssn}\n";
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment