“No-referrer-when-downgrade” Nginx 502

2019-09-20 05:03发布

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

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

标签: nginx
1条回答
我只想做你的唯一
2楼-- · 2019-09-20 05:49

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.

Solutions

  1. Best is to pass everything to https :)

  2. Change in your nginx.conf, the policy to:

    add_header 'Referrer-Policy' 'origin';
    
  3. 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';
    

More: Mozilla's reference documentation about Referer Policy.

查看更多
登录 后发表回答