Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine if current page is using SSL in Rails

I'm trying to detect if the current page is being delivered via SSL in order to decide whether 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!

like image 665
Andy Zhang Avatar asked Jul 05 '11 20:07

Andy Zhang


1 Answers

In a controller or view:

request.ssl?
like image 83
Mori Avatar answered Nov 03 '22 20:11

Mori