Port redirection is not working as expected

blason nginx-forum at forum.nginx.org
Tue Sep 21 03:51:40 UTC 2021


Hi Team,

Here is one more issue I am facing. I have portal running on
http://test.example.com:8080/AppWise and http://test.example.com/WebAdmin
Now I diverted that portal through Nginx reverse proxy

here is my config
**********
server {
        listen 8080;
        listen 80;
        server_name test.example.com;
        access_log /var/log/nginx/twprod/access.log;
        error_log /var/log/nginx/twprod/error.log;
        include /etc/nginx/applox/feeds/badips.txt;
location /AppWise/{
        client_max_body_size    10m;
        client_body_buffer_size 128k;
        proxy_send_timeout   90;
        proxy_read_timeout   90;
        proxy_buffer_size    128k;
        proxy_buffers     4 256k;
        proxy_busy_buffers_size 256k;
        proxy_temp_file_write_size 256k;
        proxy_connect_timeout 30s;
        proxy_pass http://test.example.com:8080;
        proxy_redirect off;
        proxy_set_header   Host   $host;
        proxy_set_header   X-Real-IP  $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        }
location /WebAdmin/{
        client_max_body_size    10m;
        client_body_buffer_size 128k;
        proxy_send_timeout   90;
        proxy_read_timeout   90;
        proxy_buffer_size    128k;
        proxy_buffers     4 256k;
        proxy_busy_buffers_size 256k;
        proxy_temp_file_write_size 256k;
        proxy_connect_timeout 30s;
        proxy_pass http://test.example.com:8080;
        proxy_redirect off;
        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 thing is First page open properly and then it asks for username
password; this is fine. now after login suddenly I receive 302 and page is
diverted to http://test/example.com/Appwise/<...........REST of the
URI.....>

#############
10.0.22.99 - - [20/Sep/2021:18:41:05 +0530] "POST
/AppWise/servlet/TeamAccess/Login HTTP/1.1" 302 0
"http://test.example.com:8080/AppWise/servlet/TeamAccess/Login" "Mozilla/5.0
(Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/93.0.4577.82 Safari/537.36"
10.0.22.99 - - [20/Sep/2021:18:47:42 +0530] "POST
/AppWise/servlet/TeamAccess/Login HTTP/1.1" 302 0
"http://test.example.com:8080/AppWise/servlet/TeamAccess/Login" "Mozilla/5.0
(Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/93.0.4577.82 Safari/537.36"
10.0.22.99 - - [20/Sep/2021:18:51:04 +0530] "POST
/AppWise/servlet/TeamAccess/Login HTTP/1.1" 302 0
"http://test.example.com:8080/AppWise/servlet/TeamAccess/Login" "Mozilla/5.0
(Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/93.0.4577.82 Safari/537.36"
###############

I expected for this page to stay at http://test.example.com:8080

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,292448,292448#msg-292448



More information about the nginx mailing list