Determine if visitor connected over SSL on CloudFlare Pro [closed]

为君一笑 提交于 2019-12-20 20:38:16

问题


We have a site running on CloudFlare Pro that uses their supplied certificate for one-click encryption. Our site has "optional" SSL for users. As it's a forum, we currently run a proxy script that detects if a posted image is not using a HTTPS protocol and automatically proxies the image through a script running on our server to maintain security and our lovely green lock!

My only issue now is that this introduces unnecessary load on our servers when users aren't using HTTPS so we would like to be able to detect if they are or are not. However, as the CloudFlare server is actually connecting to ours no matter what over HTTP (because we are using one-click SSL on CloudFlare) our PHP script always reports HTTP and never proxies the images even when the user is using HTTPS. Is there a way to get CloudFlare to report the user is using SSL?


回答1:


Found my answer, they send a header X-FORWARDED-PROTO. It's https for SSL and http for normal!



来源:https://stackoverflow.com/questions/15845903/determine-if-visitor-connected-over-ssl-on-cloudflare-pro

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!