简体   繁体   English

Nginx 重定向到不同的域保持 request_uri

[英]Nginx redirect to different domain keep request_uri

I wish to redirect user from my domain www.domain.com/abc/ ,我希望从我的域www.domain.com/abc/重定向用户,
To a survey on google docs and keep my domain url in browser .google docs进行调查并将我的域 url 保留在浏览器中
Here's what I've tried so far:这是我到目前为止所尝试的:

location ~ /abc/ {
        1 return 301  https://docs.google.com/forms/abcdefg?usp=sf_link;
        2 set $cleanuri $uri;
        3 return 301 docs.google.com/forms/abcdefg?usp=sf_link;
        4 proxy_set_header X-Rewrite-URL $request_uri;
        5 proxy_set_header X-Rewrite-FullURI $request_uri;
        6 proxy_set_header X-Rewrite-CleanURI $cleanuri;
}

line 1: tried to return url with line 4 proxy_set_header with request_uri .第 1 行:尝试使用第 4 行proxy_set_headerrequest_uri返回 url 。
line 2: saved uri to use with lines 3, 5, 6 to preserve original url in browser.第 2 行:保存uri以与第 3、5、6 行一起使用,以在浏览器中保留原始 url。
(hope this makes sense). (希望这是有道理的)。
No combination worx.没有组合工作。

You cannot use http://nginx.org/r/return here, neither 301 nor any other code, and http://nginx.org/r/proxy_set_header all by itself doesn't do anything.您不能在此处使用http://nginx.org/r/return ,既不是301也不是任何其他代码,并且http://nginx.org/r/proxy_set_header本身没有任何作用。

You have to either use http://nginx.org/r/proxy_pass or HTML5 iframe :您必须使用http://nginx.org/r/proxy_pass或 HTML5 iframe

  • Doing proxy_pass against docs.google.com might cause problems with too many requests coming out of a single IP address into Google Docs, which might prompt them to blacklist your IP address, and/or start giving your users captcha images to solve;docs.google.com执行proxy_pass可能会导致来自单个 IP 地址的请求过多的问题进入 Google 文档,这可能会提示他们将您的 ZA12A3079E14CED46E69BA52B8A90B 地址列入黑名单并解决;/或开始为您的用户提供 captchaAZ 地址并解决;/或it might also trigger various cross-site scripting, pfishing and hotlink protections on Google's end as well, and interfere with user authentication due to google.com cookies missing from the request;它还可能在 Google 端触发各种跨站点脚本、pfishing 和热链接保护,并由于google.com cookies 缺少请求而干扰用户身份验证; in short, this is probably not supported by Google.简而言之,这可能不受 Google 支持。

  • Likewise, the HTML iframe approach is pretty much dead nowadays, due to what is known as Clickjacking, where X-Frame-Options might prevent you from doing this embedding.同样,HTML iframe方法现在几乎已死,由于所谓的点击劫持,其中X-Frame-Options可能会阻止您进行这种嵌入。

In short, what you want to do is unlikely to be supported by Google Docs.简而言之,您想做的事情不太可能得到 Google Docs 的支持。 Even if you do manage to make it work, it'll likely get broken rather quickly.即使您确实设法使其工作,它也可能会很快损坏。

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

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