Forum Discussion

shubhankarsoni's avatar
shubhankarsoni
Icon for Nimbostratus rankNimbostratus
Aug 29, 2024

Nginx Reverse Proxy issue for port other than 81

I have a backend tomcat application which runs on port 8080 with IP 192.168.29.141. I am trying to reverse proxy using Nginx for which I have created the below configuration file:

upstream tomcat{
        server 192.168.29.141:8080;
}


server {
    #listen 192.168.122.28:80;
    
    listen 192.168.122.28:81;
    server_name tomcat;  
   location / {
        proxy_pass http://tomcat;
 }
}

When I load the page on browser, the page is distorted and I get below error in Browser console:

"Unsafe attempt to load URL http://tomcat/o/classic-theme/images/clay/icons.svg from frame with URL http://tomcat:81/. Domains, protocols and ports must match."

But when I run the nginx on port 80 instead of port 81, everything works fine. Is there anything I am missing in configurations for port other than 80 ?

 

My Nginx Server IP: 192.168.122.28

Browser screenshot when hit the URL as http://tomcat:81