Skip to content

Instantly share code, notes, and snippets.

@kmjones1979
Last active November 11, 2015 23:04
Show Gist options
  • Save kmjones1979/bc39809ac76f10fd301a to your computer and use it in GitHub Desktop.
Save kmjones1979/bc39809ac76f10fd301a to your computer and use it in GitHub Desktop.
http {
geo $subnet {
default 0;
45.55.0.0/24 1;
}
map $subnet $value {
default "";
1 $remote_addr;
}
}
server {
...
proxy_set_header Subnet $value;
proxy_pass http://upstream;
}
@kmjones1979
Copy link
Author

This configuration can be used to determine a clients address within a specific subnet and add a header with the $remote_addr variable within NGINX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment