i want to do proxy_pass
from https://foo.bar/api/v1/users/{userId}/store/{storeCode}/status
to https://bar.foo/api/v1/users/{userId}/store/{storeCode}/status
and also
from https://foo.bar/api/v1/users/{userId}/opendate
to https://bar.foo/api/v1/users/{userId}/opendate
the different with that 2 links are http method that use to access, later we will limit access with limit_except, but now i want to proxy_pass the request first.
i've made a configuration like this
location /api/v1/users/[0-9a-z]+/store {
proxy_pass https://bar.foo/api/v1/users/[0-9a-z]+/store;
proxy_set_header Host $proxy_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_buffering off;
proxy_ssl_protocols TLSv1.2;
proxy_ssl_server_name on;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass_request_headers on;
}
location /api/v1/users/[0-9a-z]+/opendate {
proxy_pass https://bar.foo/api/v1/users/[0-9a-z]+/opendate;
proxy_set_header Host $proxy_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
proxy_add_x_forwarded_for;
proxy_redirect off;
proxy_buffering off;
proxy_ssl_protocols TLSv1.2;
proxy_ssl_server_name on;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass_request_headers on;
}
but i still don't get my server proxying the request. is there anyone know how to proxy_pass long directive location with some regex in nginx ?