I have a single application available through 2 ports. One for users with sso login and other for api users using a httpAuth method. Can I use a conditional method to make both accessible through same port.
server {
listen 80;
location ~ ^/(web|search|data)/(.*) {
access_by_lua_file '/opt/sso/nginx-lua-sso/sso_impl.lua';
}
}
server {
listen 8080;
location ~ ^/(web|search|data)/(.*) {
auth_basic "Restricted Content";
auth_basic_user_file /opt/httpauth/conf/data/.htpasswd;
}
}
You could use satisfy any
directive
location ~ ^/(web|search|data)/(.*) {
satisfy any;
auth_basic "Restricted Content";
auth_basic_user_file /opt/httpauth/conf/data/.htpasswd;
access_by_lua_file '/opt/sso/nginx-lua-sso/sso_impl.lua';
}