It’s Easy! But it’s something we all have run into, and when we do we are filled with the dreaded realization that we have to use our brains again. I imagine a perfect world where we all use our brains as little as possible, and so, I give you the sfProtocolFilter. It requires three easy steps. Allow me to explain:
1) Download the class file. You can find the code here. You can put this class wherever, but I prefer to put it in /path/to/project/apps/myapp/lib/sfProtocolFilter.class.php.
2) Activate the filter in your application:
#/path/to/project/apps/myapp/config/filters.yml #... # insert your own filters here protocol: class: sfProtocolFilter
3) Turn SSL on in your application:
#/path/to/project/apps/myapp/config/app.yml
prod:
protocol:
secure: off
Make sure you only turn this on for your production environment, especially if you have a local dev install. You’ll be redirected to a nonexistent server if you activate this locally.
And that’s it! Now every time somebody visits your application, they’ll be redirected to a Secure Socket Layer. And you have managed to leave your brain out of the equation.
RSS Feed