场景前端转发给后端后会出现:
Mixed Content: The page at 'https://域名/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://域名/相关路径'
解决方式在nginx中的相关路由添加指令,具体例子如下:
location /路径/ {
# 确保这里的协议是 http,而不是 https,且端口正确
proxy_pass http://127.0.0.1:相关端口号;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
proxy_set_header X-Forwarded-Proto $scheme; 这个一定要写不然你会一脸蒙圈。
以上来源于博客-------小达博客,关于Mixed Content:The page at...was loaded over https