I'm trying to set up a server at port 8080 behind Nginx.
I want that when a attempt to reach myserver/sub, all after /sub is redirected to 8080, without sub. At the moment, I'm unable to remove sub from the URL.
my location config is:
location /sub
{
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Connection $connection_upgrade;
Upgrade $http_upgrade;
proxy_pass_header Upgrade;
proxy_pass_header Connection;
rewrite /sub/(.*) /$1 break;
proxy_pass http://localhost:8080;
}
Has you can see, I have the in developpement version a nginx to proxy websocket...
To be clear: What I want is that if I write the url myserver/sub/connect it will foward the equivalent of myserver:8080/connect, and url myserver/sub will be equivalent to myserver:8080. User however must not know that it is happening on the port 8080, and must think that every thing is in /sub.