简体   繁体   English

Nginx-重定向或重写网址

[英]Nginx - redirect or rewrite url

We have nginx setup with location proxy pass and required one specific url need to redirect or rewrite when it was hit. 我们通过位置代理传递设置了nginx,并且需要一个特定的URL,当它被命中时需要重定向或重写。

Src Url: 源网址:

https://application-url:port/services/app1/callback/?oauth_token=<<tokens>>

Dest Url: 目的地网址:

 https://application-url:port/services/app1/callback?oauth_token=<<tokens>>

Any solution here. 这里有任何解决方案。

It seems src and dest url are same. 似乎src和dest url相同。 if you want to rewrite the url: 如果要重写URL:

then add below lines in your server 然后在服务器中添加以下行

location /callback {
  rewrite ^/callback(.*) https://application-url:port/services/app1/callback$?oauth_token=<<tokens>> permanent
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM