I've got 2 upstreams and described the logic of cookie check in nginx config:
upstream back {
server backend-release.mynamespace.svc.cluster.local;
}
upstream back-preprod {
server backend-preprod.mynamespace.svc.cluster.local;
}
map $http_cookie $back_upstream {
default back;
~*is-preprod=true back-preprod;
}
location ~ ^/(api|graphql) {
proxy_pass http://$back_upstream;
}
location /rest/ {
proxy_pass http://$back_upstream/rest/;
}
When i call GET http://my-url/api/..., it works, but i always get 404 for GET http://my-url/rest/..
How to fix it?