Hi all, I have just enabled SSL on my HTTPD installation and it is working flawlessly. Even my rails app is working, and I did not change one line of code in it. I access my app trought HTTPS and every link on it keeps the HTTPS as protocol. But the problem is that wherever I use redirect_to on my app, it redirects to HTTP, and not HTTPS. I thought it would use the current protocol... How can I fix that? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Adding: I want SSL to be enabled on the whole application, and not only on a few actions/controllers. It is already working like that, just redirect_to doesn''t seem to work. On Jan 31, 12:08 pm, "felip...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <felip...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi all, > > I have just enabled SSL on my HTTPD installation and it is working > flawlessly. Even my rails app is working, and I did not change one > line of code in it. > > I access my app trought HTTPS and every link on it keeps the HTTPS as > protocol. > > But the problem is that wherever I use redirect_to on my app, it > redirects to HTTP, and not HTTPS. I thought it would use the current > protocol... > > How can I fix that?--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
My guess is that you''re using url_for() to redirect and that Rails itself isn''t managing the SSL but some other process on your server (pound, in our case). So, for us, and I''m guessing you too, Rails has no idea it''s behind an SSL connection. That that means that url_for generates a http: path instead of https:. If this is all true for you, you can use path_for instead of url_for. path_for generates a relative path instead of a full url including the protocol, which if linking inside your application, should work fine. Another option is to pass the :only_path => true argument to url_for. A third option is to just pass a hash to redirect_to, such as... redirect_to :controller => ''people'', :action => ''show'', :id => @person.id And lastly, if you''re using RESTful routes, you can just... redirect_to person_path(@person) felipekk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> Hi all, > > I have just enabled SSL on my HTTPD installation and it is working > flawlessly. Even my rails app is working, and I did not change one > line of code in it. > > I access my app trought HTTPS and every link on it keeps the HTTPS as > protocol. > > But the problem is that wherever I use redirect_to on my app, it > redirects to HTTP, and not HTTPS. I thought it would use the current > protocol... > > How can I fix that? > > > > > >-- http://www.5valleys.com/ http://www.workingwithrails.com/person/8078 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---