Not able to change the redirect path using ngnix on docker

Issue

This Content is from ServerFault. Question asked by subhra_user

I am unable to change the redirect path while using ngnix on docker. I am explaining my code below.

location / {
        # rewrite ^/static(.*) /$1 break;
        # root /static;
        return 301 $scheme://$host:$server_port/site;
        alias /app/static/angular;
        try_files   $uri $uri/ /index.html =404;
    }

    location /node {
        proxy_pass http://127.0.0.1:8081;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
    }

here my requirement is when user will type only https://localhost:port/ on browser then the URl should be changed to https:localhost:port/site on browser and same index page will be loaded.any help will be more appreciated.



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from serverfault, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?