nginx keeps redirecting to welcome page

Posted on

QUESTION :

I am using the following config:

server {
    listen       80;
    server_name  192.168.1.10;
location /shutter {
    proxy_pass http://192.168.1.10:8989;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

The application I am using is called shutter lite: http://www.den4b.com/?x=products&product=shutter

When I enter

http://192.168.1.10:8989

it takes me to ‘login’ screen and then the web interface of the application, so that works.

But, When I enter

http://192.168.1.10/shutter

I get to the ‘login’ screen for the application. As soon as I login, it takes me to the nginx welcome screen instead of the web interface of the application.

The above config works for other applications, it is only the shutter application that gives me this problem.

I am not sure where I am going wrong..

Any suggestions?

ANSWER :

From the little information you gave, it could be necessary to add

proxy_redirect / /shutter;

So in case the application creates a redirect, nginx can replace it with the subfolder you’re using.

Also (as stated in my comment) it could be possible that the application uses a mix of absolute and relative paths. Then you need to replace that with sub_filter module.

sub_filter_types text/xml text/html;
sub_filter 'http://localhost:8989/' '/';
sub_filter_once off;

Leave a Reply

Your email address will not be published. Required fields are marked *