« July 2010 | Main | October 2010 »

August 2010 Archives

August 7, 2010

Force all Sinatra traffic to https

I wanted to have all traffic on a site go through https. Since the site was on heroku. @env['rack.url_scheme'])=='https' wasn't a sufficient way of detecting if on https. You need to also check (@env['HTTP_X_FORWARDED_PROTO']. Below I wrote a simple before filter which you could place in the production configuration. After talking with the author of rack-ssl-enforcer I got that patched to work on heroku as well. So that is an even simpler option.

Anyways, I spent far to long googling sinatra https, sinatra ssl, sinatra over https, sinatra secure, and heroku https, and couldn't find good pages on this for awhile. So here is the info for anyone else wanted to host secure Sinatra pages on heroku.

Web 2.0 craziness

View Dan Mayer's profile on LinkedIn


I Power Seekler
I Power Seekler

www.flickr.com
This is a Flickr badge showing public photos and videos from mayer_dan. Make your own badge here.

Creative Commons License
This weblog is licensed under a Creative Commons License.