Nginx authentication based on parameterized url
tmuesele
nginx-forum at forum.nginx.org
Wed Dec 21 10:19:55 UTC 2016
Hi there,
I need an authentication based on a parameterized class call in a url. For
example the url:
https://sample.com/index.php?cl=accesstestprivate
should be access-able by IP address 192.168.1.1, if the request doesnt come
from this IP, a basic auth should be invoked.
All other / pages e.g. index.php, index.php?start=1 should be access-able by
public.
I was trying to use the map function. But in this case, the site is not
available from public.
map $arg_cl $auth_type {
default „off";
"accesstestprivate“ "closed";
}
location / {
satisfy any;
allow 192.168.1.1;
auth_basic $auth_type;
auth_basic_user_file conf/htpasswd;
proxy_pass http://devserver;
}
Any ideas?
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,271665,271665#msg-271665
More information about the nginx
mailing list