I want to have mixed https/http site.
Moreover I want have redirects from https to http(ie. after user login successfully it should redirect to root page at http).
Gems like:
- rack-ssl
- rack-ssl-enforcer
works perfectly but only If you want to have entire site at https
“Mixed http/https” with only ssl at A, B, C actions and only http at D, E, F – dont work.
I checked solution from another SO thread:
Rails 3 SSL routing redirects from https to http
Almost works.
Its easy to write script which will change(on entire views) helper from “_path” to “_url”.
But there is a problem with links like:
<%= link_to "model", some_model %>
<%= link_to "edit model", edit_mode_url(model) %>
...
There are many diffrent models and I use often “model” at iteration blocks, so solution based on ‘rewrite’ script will dont work with that.
Questions:
Is there a way to change behavior of <%= link_to 'model', model %> code to fix that? Is there a possibility to overwrite path helper(standard protocol will be http, on giver parameter – https)?
Or maybe there is a another solution which I have not found yet?
Edit:
I work with Rails 3.0.9.
Use this gem:
https://github.com/retr0h/ssl_requirement
gem install ssl_requirementThen to add
ssl_required :new, :destroy #others actionsto your controllers.
If you use devise you have to overwrite each controller and specify all actions
It works with Rails 3.0.x