如果您使用的是 Nginx,可以在 Nginx 配置文件中取消强制 HTTPS 跳转。具体操作如下:
打开 Nginx 配置文件(默认路径为 /etc/nginx/nginx.conf)
在 http 块中添加以下代码:
map $http_x_forwarded_proto $canonical_scheme {
default $http_x_forwarded_proto;
"" $scheme;
}
server {
listen 80;
server_name example.com;
return 301 $canonical_scheme://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name example.com;
ssl_certificate /path/to/certificate.crt;
ssl_certificate_key /path/to/private.key;
#其他配置
}
- 重启 Nginx 服务,使配置生效。
注意:以上方法仅适用于 Nginx,如果您使用的是其他 Web 服务器,可以根据其不同的配置语法进行相应的修改。