I've got problem with nginx reverse proxy. Want to proxy (traefik. Traefik its in swarm. Its accessible from http://traefik.brt.local. (labels by traefik)
Now in server with nginx (serverNginx) I've got specified /etc/hosts
#rpicluster - swarm
192.168.1.109 traefik.brt.local
192.168.1.109 helloworld.brt.local
Now I want to got Traefik on path /testowe. tried solution below but not working.
location /testowe {
rewrite ^/testowe(.*) /$1 break;
proxy_pass http://traefik.brt.local;
}
If I put everything on /, then everything works but I dont want on root path.
location / {
proxy_pass http://traefik.brt.local;
}
curl on domain
curl -IL traefik.brt.local
HTTP/1.1 308 Permanent Redirect
Content-Length: 18
Content-Type: text/plain; charset=utf-8
Date: Fri, 05 Feb 2021 09:14:42 GMT
Location: http://traefik.brt.local/dashboard/
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 3026
Content-Type: text/html; charset=utf-8
Date: Fri, 05 Feb 2021 09:14:42 GMT
Last-Modified: Tue, 02 Feb 2021 17:20:37 GMT
curl on localhost/testowe
curl -IL localhost/testowe
HTTP/1.1 308 Permanent Redirect
Server: nginx/1.14.2
Date: Fri, 05 Feb 2021 09:15:24 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 18
Location: http://localhost/dashboard/
Connection: keep-alive
HTTP/1.1 200 OK
Server: nginx/1.14.2
Date: Fri, 05 Feb 2021 09:15:24 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 3026
Connection: keep-alive
Accept-Ranges: bytes
Last-Modified: Tue, 02 Feb 2021 17:20:37 GMT
curl on localhost
curl -IL localhost
HTTP/1.1 308 Permanent Redirect
Server: nginx/1.14.2
Date: Fri, 05 Feb 2021 09:16:00 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 18
Location: http://localhost/dashboard/
Connection: keep-alive
HTTP/1.1 200 OK
Server: nginx/1.14.2
Date: Fri, 05 Feb 2021 09:16:00 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 3026
Connection: keep-alive
Accept-Ranges: bytes
Last-Modified: Tue, 02 Feb 2021 17:20:37 GMT
question from:https://stackoverflow.com/questions/66060583/nginx-reverse-proxy-with-path