“降级时没有引荐来源" Nginx 502 [英] "No-referrer-when-downgrade" Nginx 502

查看:453
本文介绍了“降级时没有引荐来源" Nginx 502的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站某些页面上出现502错误,我不明白为什么某些页面可以工作,但其他页面却显示此错误:

I have a 502 error on some pages of my site, I do not understand why some pages work but others display this error:

请求方法:POST 状态码:502错误的网关 推荐人政策:降级时不推荐人

Request Method:POST Status Code:502 Bad Gateway Referrer Policy:no-referrer-when-downgrade

推荐答案

问题

您已将引荐政策设置为"no-referer-when- Nginx中的降级",这意味着在降级(https提交到简单http)的情况下,不会发送引荐来源信息(作为您的表单网址).而且您背后的代码不喜欢没有这些信息.

Problem

You have the Referer Policy set to "no-referer-when-downgrade" in Nginx, which means referer information (as your form URL) is not sent in case of downgrade (httpS submitting to simple http). And your code behind doesn't like not having this piece of information.

  1. 最好是将所有内容传递给http s :)

将nginx.conf中的策略更改为:

Change in your nginx.conf, the policy to:

add_header 'Referrer-Policy' 'origin';

  • 如果2.不起作用,请按照1.中所述进行操作,或者也可以(但是请 不要这样做,这是非常不安全的):

  • If 2. doesn't work, please do as said in 1., or you can also (but please don't do that, it's very unsecure):

    add_header 'Referrer-Policy' 'unsafe-url';
    


  • 更多: 有关参考政策的Mozilla参考文档. /em>


    More: Mozilla's reference documentation about Referer Policy.

    这篇关于“降级时没有引荐来源" Nginx 502的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆