简体   繁体   English

Nginx 重定向到编码的 URL 作为 nginx 中的参数传递?

[英]Nginx redirecting to an encoded URL passed as a argument in nginx?

I want to redirect from nginx to a URL that is send as an argument in the encoded form.我想从 nginx 重定向到以编码形式作为参数发送的 URL。

location /v1/redirect {
        access_log /var/log/nginx/redirect/access.log main;
        error_log /var/log/nginx/redirect/error.log;
        return 302 $arg_dest;
        }

When I am passing unencoded URL for eg https://ex2.example2.com/v1/redirect?dest=https://ex1.example2.com It is working fine.当我传递未编码的 URL 例如https://ex2.example2.com/v1/redirect?dest=https://ex1.example2.com ,它工作正常。

But on encoding dest argument as https://ex2.example2.com/v1/redirect?dest=https%3A%2F%2Fex1.example2.com .但是将 dest 参数编码为https://ex2.example2.com/v1/redirect?dest=https%3A%2F%2Fex1.example2.com I am getting status code 304 and my URL is changing to https://ex2.example2.com/v1/https%3A%2F%2Fex1.example2.com .我收到状态代码 304,我的 URL 正在更改为https://ex2.example2.com/v1/https%3A%2F%2Fex1.example2.com

Can someone help me identify what I am doing wrong, Is there a way to possibly URL decode arg_dest before passing to return?有人可以帮我确定我做错了什么吗,有没有办法让 URL 在传递返回之前解码 arg_dest? Thanks谢谢

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

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