Nginx-重定向或重写url

Nginx-重定向或重写url,nginx,url-rewriting,url-redirection,Nginx,Url Rewriting,Url Redirection,我们有nginx设置和位置代理通行证,并需要一个特定的url需要重定向或重写时,它被击中 Src Url: https://application-url:port/services/app1/callback/?oauth_token=<<tokens>> https://application-url:port/services/app1/callback/?oauth_token= Dest Url: https://application-url:port/

我们有nginx设置和位置代理通行证,并需要一个特定的url需要重定向或重写时,它被击中

Src Url:

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

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

这里有任何解决方案。

似乎src和dest url是相同的。如果要重写url,请执行以下操作:

然后在服务器中添加以下行

location /callback {
  rewrite ^/callback(.*) https://application-url:port/services/app1/callback$?oauth_token=<<tokens>> permanent
}
位置/回调{
重写^/回调(.*)https://application-url:port/services/app1/callback$?oauth_令牌=永久
}

在目标url中,我想删除“/”。您可以在src和dest中看到这种变化。另外,其他服务的动态或自动生成的值是否不是静态的。您是否尝试过nginx?的服务器指令中的上述行。这应该可以解决您的需求