How can I prevent port number from being attached to url in nginx

54 Views Asked by At

Consider the server name www.example.com and the application should work on the port number 3000.

When I type www.example.com/user which is the proxied url for our user application received from the host team, the application does not work. It authomatically redirects from www.example.com/user to www.example.com:3000/user/

But When I type www.example.com/user/ with trailing slash at the end, the application works perfectly.

I want the application to work when typing www.example.com/user without redirecting to www.example.com:3000/user/

For that, it should not add :3000 anymore on the url and the application should work. Thank you for helping.

Here is my code:

worker_processes 1;
events {
    worker_connections 4096;
}

http {
    include mime.types;
    sendfile on;

    server {
        listen 3000 ssl;
        listen [::]:3000 ssl;

        resolver 127.0.0.11;
        autoindex off;

        server_name dthhub.umadev.dth.ihost.com;
        server_tokens off;

        ssl_certificate  /etc/nginx/d2dnode02.crt;
        ssl_certificate_key  /etc/nginx/d2dnode02.key;
        

        location /user {
            #alias /app/dist/dashboard-user;
            alias /usr/share/nginx/html;
            index index.html;
        }
        gzip_static on;
    } 

}
0

There are 0 best solutions below