When using redirect_to example_path
in the controller the protocol gets changed to http. I want the protocol to remain the same as the original request e.g. if I'm using https I want to be redirected to https://example_path... and if I'm using http I want to be redirected to http://example_path...
I know I can use config.force_ssl = true
but I want ssl to be optional.
redirect_to takes a protocol key in its args hash. You can do
redirect_to example_path, protocol: request.protocol
and that should get you sorted. Let me know if that doesn't work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With