需要在GET/POST中使用请求参数和请求正文将条件url“重定向”到另一个域。这就是它现在的工作方式。
location ~* /aa/.*/bb.json{
proxy_pass http://127.0.0.1:7001;
if ($arg_bornEnv = pro ) { rewrite ^.*$ http://pro.xxxx.com$uri last;}
if ($arg_bornEnv = pre ) { rewrite ^.*$ http://pre.xxxx$uri last;}
}
它在浏览器中工作,并会将url重定向到带有"302“代码的目的地。这意味着它将更改url字段中的url。我想在一个请求中完成这个抛出代码,例如httpclient等。
这可以通过有条件的代理传递来完成吗?
发布于 2018-06-02 08:18:36
location ~* /aa/.*/bb.json{
if ($arg_bornEnv = pro ) { rewrite ^.*$ http://pro.xxxx/$1 redirect;}
if ($arg_bornEnv = pre ) { rewrite ^.*$ http://pre.xxxx/$1 redirect;}
proxy_pass http://127.0.0.1:7001;
}
发布于 2018-06-02 23:06:07
location ~* /aa/.*/bb.json {
if ($arg_bornEnv = pro ) { proxy_pass http://pro.xxxx;}
if ($arg_bornEnv = pre ) { proxy_pass http://pre.xxxx;}
proxy_pass http://127.0.0.1:7001;
}
这就是它现在的工作方式。
https://stackoverflow.com/questions/50642167
复制相似问题