Eu tenho este proxy passado na minha configuração nginx.
location /content {
proxy_set_header Host $proxy_host;
proxy_pass $address1;
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'POST') {
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
}
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
}
}
Gostaria de proxy_pass /content
to $address1
mas gostaria de proxy_pass de qualquer outro /content/something_else
to $address2
isso é possível no nginx?
Por exemplo, se eu atingir http://www.example.com/content?some_other_param=value
, ele será encaminhado para http://www.content.com
, mas se eu atingir http://www.example.com/content/article?some_param=value
, ele atingirá http://www.different_content.com