Mixed Content: The page at ‘https://域名/‘ was loaded over HTTPS

场景前端转发给后端后会出现:

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

相关推荐
Thanks_ks30 分钟前
HTTP 请求方法与 RESTful 接口设计:GET 和 POST 到底怎么用
http·api·restful·状态码·get·post·接口设计
LK_071 天前
【FastAPI】基础篇 01|开始之前:API、HTTP 与 FastAPI 到底是什么
网络协议·http·fastapi
阿星_1 天前
pydio登陆不了分析问题
网络协议·http·https
Joy T1 天前
Gzip 压缩原理与实践:HTTP 响应压缩、性能收益与工程配置
网络·网络协议·http
陈希1232 天前
Nginx 从入门到能扛事:反向代理、负载均衡与 HTTPS 实战
nginx·https·负载均衡
博客zhu虎康3 天前
实现局域网P2P通信:内网发送消息
网络·网络协议·p2p
FungLeo3 天前
成为全栈·基础补充·域名、DNS 与 HTTPS 证书
https·网络基础·网站部署·tls证书·成为全栈·域名 dns
xixingzhe24 天前
AI 对话打字机效果:SSE 和 HTTP 的区别与适用场景
网络·网络协议·http
叼烟扛炮4 天前
Linux 学习笔记(五十一):数据链路层与 ARP 协议——局域网寻址与黑客骗局
linux·网络·网络协议·php·tcpdump
沫璃染墨4 天前
从零入门计算机网络系列(十四):TCP报文与字节流本质——从数据封装到报文边界
linux·服务器·网络·网络协议·tcp/ip·tcp