B
B
bruges2017-07-16 05:10:40
Nginx
bruges, 2017-07-16 05:10:40

How to replace URL in browser in NGINX+TOMCAT bundle?

nginx proxies incoming connections to the local tomcat with the application deployed to it as follows:

upstream tomcat {
    server 127.0.0.1:8080 fail_timeout=0;
}

server {
    server_name domain.com;
    location / {
        proxy_pass http://tomcat/app/;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
        rewrite ^/app/(.*)$ /$1 last;
    }

    location /app {
        rewrite ^/app(.*)$ $1 redirect;
    }
}

The last location section is needed to make domain.com/app/something just domain.com/something (for this manu ). Everything works fine, BUT the application (deployed in a tomket) uses its own internal redirects and always returns some additional url in the form of that something something . It is always the same and has the # symbol in it. I always end up with urls like this:
1. domain.com/users/index.html#/login
2. domain.com/users/index.html#/settings
3. domain.com/users/index.html#/logout
etc.
How to improve the URL by removing the /users/index.html# substring in the client browser so that it is simple:
1. domain.com
2. domain.com/settings
3. domain.com/logout
etc.
At the same time, I don’t know what other redirects this application has inside the login/settings/logout, so that I don’t have to manually write a rule for each location. Is there any way to get rid of this garbage?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Puma Thailand, 2017-07-19
@opium

Rewrite will not help here, file the Java apk itself

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question