Answer a question

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

Answers

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' 'same-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.

Note: origin will only set the base URL with no URI like https://domain-name.com/. While same-origin will set the full Secure URL as the Referer if it's from the same domain. It's secure since the header is passed on the :433 secure port listening.

Logo

开发云社区提供前沿行业资讯和优质的学习知识,同时提供优质稳定、价格优惠的云主机、数据库、网络、云储存等云服务产品

更多推荐