开发者

Determine if current page is using SSL in Rails

开发者 https://www.devze.com 2023-03-18 09:35 出处:网络
I\'m trying to detect if the current page is being delivered via SSL in order to decide whethe开发者_运维技巧r or not to include certain unsecure external resources. My current method involves checkin

I'm trying to detect if the current page is being delivered via SSL in order to decide whethe开发者_运维技巧r or not to include certain unsecure external resources. My current method involves checking if request.url starts with 'https'. Is this the simplest way of accomplishing this? Is there a better way? Thanks!


In a controller or view:

request.ssl?
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号