I would like to do something like:
location ~ ^/authorize/(\w+)$ {
proxy_pass http://my.vm/auth;
proxy_pass_request_body on;
proxy_set_header MY_CUSTOM_HEADER $1;
proxy_pass_request_headers on;
}
However, I get the following error message:
nginx: [emerg] "proxy_pass" cannot have URI part in
location given by regular expression, or inside named location,
or inside "if" statement, or inside "limit_except" block in
nginx.conf
Any help would be appreciated.
Thanks in advance
The error message is correct, that's not a valid config. There is a workaround a vaguely remember reading about which these other questions describe
Nginx location regex doesn't work with proxy pass
Nginx. Using redirects with regular expressions
There are also plenty of articles to be found via Google. If the workaround above doesn't work you'll have to rethink your approach.