【问题标题】:Rewrite header Location from HTTP to HTTPS将标头位置从 HTTP 重写为 HTTPS
【发布时间】:2020-12-16 22:47:01
【问题描述】:

Nginx 在其回复中添加了 Location 标头。这是在 HTTP 中的。我想用 HTTPS 替换它。

我尝试使用 proxy_redirect。

使用硬 URL,它可以工作:

proxy_redirect http://www.mywebsite.com/fr/connexion?toUrl=%2Ffr https://www.mywebsite.com/fr/connexion?toUrl=%2Ffr;

但是,我无法在命令中集成 RegEx 以使其每次都能正常工作。

你有什么想法吗?

【问题讨论】:

  • 不需要指定整个网址,试试:proxy_redirect http:// https://;
  • 这比我想象的还要简单。我确认它有效。感谢您的帮助!

标签: nginx


【解决方案1】:

正如 Richard Smith 所说,没有必要使用 REGEX。只需填写以下指令:

proxy_redirect http:// https://;

proxy_redirect http://www.yourwebsite.com/ https://www.yourwebsite.com/;

感谢Richard Smith 提供答案

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-06
    • 2013-10-27
    • 2011-03-11
    • 1970-01-01
    • 1970-01-01
    • 2014-03-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多