Hello everyone rails3.2 ruby 1.9.3 nginx 1.5 passenger 4 I''m using force_ssl<http://apidock.com/rails/v3.2.13/ActionController/ForceSSL/ClassMethods/force_ssl>in a controller on our site, and certain actions within that controller. force_ssl :only => [:show, :list, :toilet] This works great, I can go to the site via http, no problems, and when I click on the link responding to the controller the https kicks in, and is also active on the other actions specified within that controller. The issue I''m getting is after using that controller, which forces https, clicking on any other links within that site still uses https. That''s not what I imagined to happen, and may cause an issue. Is the browser caching the https traffic and assuming to use it again? Is there any way around this? Any help, greatly appreciated. V -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5ef7edb6-5502-464d-8f60-c0c28a0af977%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Ok, I''ve worked out what''s happening. When you''re on the page that has been forced to be ssl, then all of your links that use /something will now pick up the https. So all my main navigation links are pointing to https I can''t change them as the site won''t work in development then or on any testing and staging servers. um, this is a right pain in the arse. Anyone know a way around it? On Friday, 12 July 2013 11:00:24 UTC+1, vanderkerkoff wrote:> > Hello everyone > > rails3.2 ruby 1.9.3 nginx 1.5 passenger 4 > > I''m using force_ssl<http://apidock.com/rails/v3.2.13/ActionController/ForceSSL/ClassMethods/force_ssl>in a controller on our site, and certain actions within that controller. > > force_ssl :only => [:show, :list, :toilet] > > This works great, I can go to the site via http, no problems, and when I > click on the link responding to the controller the https kicks in, and is > also active on the other actions specified within that controller. > > The issue I''m getting is after using that controller, which forces https, > clicking on any other links within that site still uses https. > > That''s not what I imagined to happen, and may cause an issue. > > Is the browser caching the https traffic and assuming to use it again? > > Is there any way around this? > > Any help, greatly appreciated. > > V > > > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/59dff581-04cc-46cd-a68e-a19e57639b66%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
How are you generating the URLs for the links? If you are using something like this: projects_path You can change it to this, which will generate a fully qualified URL (with host and protocol): projects_url And to explicitly break out of HTTPS, you can do the following: project_url(:protocol => :http) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9586b1d2-763b-4d46-8de5-fcc1d06b0731%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Hi Tim They are navigation links in a global template set, haml. %li.events %a{ :href => "/events",:title =>"Events" } Events I think I''m stuffed. Even if I created a subset of the navigation set just for this section using full URLS, I''m still stuffed in development or any of the other testing servers with different URLs. Any other ideas? On 12 July 2013 13:40, Timster <timshaffer00-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> How are you generating the URLs for the links? > > If you are using something like this: > > projects_path > > You can change it to this, which will generate a fully qualified URL (with > host and protocol): > > projects_url > > And to explicitly break out of HTTPS, you can do the following: > > project_url(:protocol => :http) > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Ruby on Rails: Talk" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/rubyonrails-talk/y7nRFfOzxi0/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/9586b1d2-763b-4d46-8de5-fcc1d06b0731%40googlegroups.com > . > > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAEo0_UjjXGjOt%2BsRFf25O_SzQOObcbcqCH50%2B-M0DuW-0jG86g%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
You''re not stuffed. Right now you''re generating the <a> tag manually with the path "/events" If you switch to Rails helpers to generate the URL, your problems can be solved. Which helpers you use depends on how your routes are set up. How do you have your routes set up? Do you have something like this? resources :events If so, you can replace your %a link with this: link_to(''Events'', events_url(:protocol => ''http'')) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/89ee512e-541f-4666-a063-98a4a8eb7947%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Tim, thanks for the help, worked a treat. On 12 July 2013 13:59, Timster <timshaffer00-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You''re not stuffed. > > Right now you''re generating the <a> tag manually with the path "/events" > > If you switch to Rails helpers to generate the URL, your problems can be > solved. Which helpers you use depends on how your routes are set up. > > How do you have your routes set up? Do you have something like this? > > resources :events > > If so, you can replace your %a link with this: > > link_to(''Events'', events_url(:protocol => ''http'')) > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Ruby on Rails: Talk" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/rubyonrails-talk/y7nRFfOzxi0/unsubscribe > . > To unsubscribe from this group and all its topics, send an email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/89ee512e-541f-4666-a063-98a4a8eb7947%40googlegroups.com > . > > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAEo0_Ui%3DYTvQ0QGpGawzLSM5mL9BS35q_UVhF%2B2RJQ_AWAhAFA%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.