Php judges whether it is https or not.

on the Internet, many methods of judging https are stereotyped.
mainly judges
reference links from $_ SERVER to
https://blog.csdn.net/river13.
https://codeshelper.com/q/10.

.

but now nginx has done reverse proxy
$_ SERVER without the following parameters:
HTTPS
HTTP_X_FORWARDED_PROTO
HTTP_FRONT_END_HTTPS

not even SERVER_PORT is 443

how to judge https?


these things that need to be received in nginx plus header,php are all upstream. If nginx doesn't give it to you, php can't get these things.


is your https implemented in php or in nginx?


add a configuration in nginx proxy_set_header X-Forwarded-Proto $scheme; send the protocol used by the frontend to the backend, and your backend can judge based on this request header.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b347a4-342c8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b347a4-342c8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?