0

I am running NGINX with a proxy pass and basic authentication.

The problem: The proxy pass is forwarding to an AppDaemon that is running a custom application that I am unable to modify. I would like to secure the access with basic authentication, but, another program is accessing this web address and it cannot handle a pop-up password prompt like basic authentication.

Passing the username / password in the url for basic authentication is not a possible option for me as it is not supported in my scenario.

What I would like to do is have a PHP script (or something similar) handle the login details then forward to the AppDaemon, but it is listening on another port.

Here is my NGINX server config

server {

listen 443;
server_name  test.com.net;
access_log /var/log/test/access.log;
error_log /var/log/test/error.log;

# can't use pop-up basic auth, and usr/pass info in url not possible
#auth_basic "ask password";
#auth_basic_user_file /etc/nginx/.htpasswd;

location / {
proxy_pass http://127.0.0.1:5050;

}
}

What I would like my PHP script to do

//run my auth checks in PHP then 
header("Location:localhost:5050");
exit;

Obviously this doesn't work as it would be calling localhost on the client side and not the server side.

I am looking for any ideas on how I could solve this problem?

Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.