为了账号安全,请及时绑定邮箱和手机立即绑定

无法判断是否 https 请求

无法判断是否 https 请求

PHP
MMTTMM 2019-03-18 16:53:27
http 网站升级 https 在 https 状态下打印 $_SERVER ["REQUEST_SCHEME"] => string(4) "http" ["SERVER_PROTOCOL"] => string(8) "HTTP/1.0" 等信息全是http,这是什么原因??   先谢谢大家回答,我的 $_server 全部都没有标识https;附上我的nginx 配置 server { listen 80; root /www; server_name xx.com; rewrite ^(.*)$ https://$host$1 permanent; index index.html index.php index.htm; location ~ \.php$ { proxy_pass http://127.0.0.1:88; include naproxy.conf; } location ~ /\.ht { deny all; } location / { try_files $uri @apache; } location @apache { internal; proxy_pass http://127.0.0.1:88; include naproxy.conf; } } server { listen 443; root /www; ssl on; ssl_certificate cert/xx.com.crt; ssl_certificate_key cert/xx.com.key; ssl_prefer_server_ciphers on; ssl_session_timeout 10m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; server_name xx.com; index index.html index.php index.htm; location ~ \.php$ { proxy_pass http://127.0.0.1:88; include naproxy.conf; } location ~ /\.ht { deny all; } location / { try_files $uri @apache; } location @apache { internal; proxy_pass http://127.0.0.1:88; include naproxy.conf; } }
查看完整描述

6 回答

?
jeck猫

TA贡献1909条经验 获得超7个赞

$_SERVER['HTTPS']

$_SERVER['SERVER_PORT'] == 443

查看完整回答
反对 回复 2019-03-18
?
暮色呼如

TA贡献1853条经验 获得超9个赞

nginx fastcgi参数设置了吗

查看完整回答
反对 回复 2019-03-18
?
人到中年有点甜

TA贡献1895条经验 获得超7个赞

你访问的这个地址,到达的第一个 WEB 服务器(处理了你这个 HTTPS 的请求的那个),与你在页面中看到的那个 php 服务器,又不一定是同一个东西。

查看完整回答
反对 回复 2019-03-18
?
RISEBY

TA贡献1856条经验 获得超5个赞

$_SERVER ['HTTP_X_FORWARDED_PROTO']

查看完整回答
反对 回复 2019-03-18
?
米脂

TA贡献1836条经验 获得超3个赞

isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == "on")
找找这2个有吗,我用这2个判断的,ok的

查看完整回答
反对 回复 2019-03-18
  • 6 回答
  • 0 关注
  • 653 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信