0

I am using Heroku SSL and I need one of my Rails controllers to not use SSL.

I tried a before_filter in my controller:

if request.ssl? && Rails.env.production?
  redirect_to :protocol => 'http://', :status => :moved_permanently
end

Unfortunately, this ended in a too many redirects error. How can I create an exception for this controller? Thank you very much.

sscirrus
  • 55,407
  • 41
  • 135
  • 228
  • just curious, why would you not use ssl ? – Alfie Jul 04 '16 at 19:53
  • That controller includes pages that have a websocket connection. [I am trying](http://stackoverflow.com/questions/38133690/adding-wss-to-websocket-autobahn-wamp-twisted) to get that connection to work over WSS, but in the meanwhile I need the app to continue to work. (As it is, trying to load an SSL page with a WS connection causes browser errors.) – sscirrus Jul 04 '16 at 19:55
  • i think you should handle this in the web server end and not from the app. for ngnix check this out : https://github.com/nicokaiser/nginx-websocket-proxy – Alfie Jul 04 '16 at 20:00
  • @Alfie Do you mean handle the website SSL over nginx or the websockets? I'm using Autobahn|JS for websockets. – sscirrus Jul 04 '16 at 20:02
  • Do the logs show any other filters doing redirects? – Frederick Cheung Jul 04 '16 at 20:07
  • How do you redirect from http to https? Do you use the Rails force_ssl feature? – Simone Carletti Jul 05 '16 at 09:45

0 Answers0