I have such url under nginx: http://localhost:8080/my_backend/test/whatever
which I need to rewrite to http://dockerized_backend:8081/test/whatever
dockerized_backend is of course from docker-compose, not public
how to do that ? thanks!
ah simple:
location /my_backend {
rewrite /my_backend/(.*) /$1 break;
proxy_pass http://my_backend:8080;
proxy_redirect off;
proxy_set_header Host $host;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.