I have a question regarding the allow/deny rule for NGINX based on User Agent+IP.
I currently have the following in my nginx.conf to permit all Internet connections based on a certain User Agent Value of "iOS".
server {
proxy_set_header Proxy-Connection "";
listen *:8443;
server_name myserver.com;
if ($http_user_agent !~* (ELB|ios)) {
return 403;
}
location / {
proxy_http_version 1.1;
proxy_pass https://myserver;
proxy_set_header Connection "upgrade";
}
}
I wanted to permit access to the following combination of:
- Any "IP" + "UserAgent" value of 'iOS'
or
- IP Subnet 192.168.2.0/24 + "UserAgent" value of 'chrome'
Thanks in advance.