I found that AJAX calls were not working on my Rails site when a page was using SSL/HTTPS. I worked around this by adding
ssl_allowed :action1, :action2, :actionN
to the controllers involved.
I foresee this being a pain and prone to bugs in the future, as I'll indubitably forget to add an action to the ssl_allowed list.
Is there a way to turn on ssl_allowed
/ssl_required
globally in the [ssl_requirement][1] gem, for all actions of every controller in my site? I tried adding the following to ApplicationController, but that did not work:
ssl_allowed :all
If you'd rather not depend on a forked plugin, you can override ssl_allowed? in your controller:
EDIT: This does not do what I thought it did. Instead of disabling redirects to http for pages that are not specified ssl_required, it short circuts the whole redirect process to do nothing. This is very bad. The code:
Adding the ssl_allowed? method like this would only be the answer if the code instead read:
I found grosser's ssl_requirement fork at github (link) which enables "ssl_allowed :all" and replaced my copy of the gem with that version. Now I'm using "ssl_allowed :all" in my ApplicationController and nowhere else. Exactly what I wanted.