CuriousNewbie
2010-Dec-01 21:44 UTC
How to Redirect from http://mysite.com to https://www.mysite.com on Herok
Hello I''m looking to learn how to redirect all non-www (mysite.com) to https://www.mysite.com I tried the following: class ApplicationController < ActionController::Base before_filter :check_uri def check_uri redirect_to request.protocol + "www." + request.host_with_port + request.request_uri if !/^www/.match(request.host) if Rails.env =''production'' end Problem with this is since the SSL cert on Heroku is for www.mysite.com, and not mysite.com, the browser throws the nasty SSL HTTPS invalid warning. Any ideas on how to redirect in a way that avoids the nasty SSL HTTPs invalid warning? Thanks -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Tilde Equals
2010-Dec-02 18:25 UTC
Re: How to Redirect from http://mysite.com to https://www.mysite.com on Herok
CuriousNewbie, This is going to be more requests, but I think the easiest way to do it is probably to redirect traffic from mysite.com to www.mysite.com, like you''re doing, and then redirect traffic from http: to https: using something like ssl_requirement. That way, if somebody visits http://mysite.com/, they''ll be redirected to http://www.mysite.com/ and then redirected again to https://www.mysite.com/. Tilde Equals On Dec 1, 1:44 pm, CuriousNewbie <bhellm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello I''m looking to learn how to redirect all non-www (mysite.com) tohttps://www.mysite.com > > I tried the following: > > class ApplicationController < ActionController::Base > > before_filter :check_uri > > def check_uri > redirect_to request.protocol + "www." + request.host_with_port + > request.request_uri if !/^www/.match(request.host) if Rails.env => ''production'' > end > > Problem with this is since the SSL cert on Heroku is forwww.mysite.com, > and not mysite.com, the browser throws the nasty SSL HTTPS invalid > warning. > > Any ideas on how to redirect in a way that avoids the nasty SSL HTTPs > invalid warning? > > Thanks-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Tim Shaffer
2010-Dec-02 18:55 UTC
Re: How to Redirect from http://mysite.com to https://www.mysite.com on Herok
On Dec 1, 4:44 pm, CuriousNewbie <bhellm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Any ideas on how to redirect in a way that avoids the nasty SSL HTTPs > invalid warning?I have never used Heroku, but couldn''t you just use "https://" in the redirect instead of request.protocol? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Emanuele Tozzato
2010-Dec-03 02:24 UTC
Re: How to Redirect from http://mysite.com to https://www.mysite.com on Herok
Hi, you can try to modify the ssl_requirements the plugin to fit your need. Warning: I was using it a couple of years ago and my suggestion may be outdated :) trigger the ssl required with ssl_required :action_name in the controller and modify ensure_proper_protocol to add ''www'' when missing: https://gist.github.com/726486 On Wed, Dec 1, 2010 at 1:44 PM, CuriousNewbie <bhellman1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello I''m looking to learn how to redirect all non-www (mysite.com) to > https://www.mysite.com-- Emanuele Tozzato http://mekdigital.com -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Phillip
2010-Dec-03 18:54 UTC
Re: How to Redirect from http://mysite.com to https://www.mysite.com on Herok
This would typically be done by the server (usually Apache). http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html On Dec 1, 4:44 pm, CuriousNewbie <bhellm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello I''m looking to learn how to redirect all non-www (mysite.com) tohttps://www.mysite.com > > I tried the following: > > class ApplicationController < ActionController::Base > > before_filter :check_uri > > def check_uri > redirect_to request.protocol + "www." + request.host_with_port + > request.request_uri if !/^www/.match(request.host) if Rails.env => ''production'' > end > > Problem with this is since the SSL cert on Heroku is forwww.mysite.com, > and not mysite.com, the browser throws the nasty SSL HTTPS invalid > warning. > > Any ideas on how to redirect in a way that avoids the nasty SSL HTTPs > invalid warning? > > Thanks-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Tim Shaffer
2010-Dec-03 19:06 UTC
Re: How to Redirect from http://mysite.com to https://www.mysite.com on Herok
On Dec 3, 1:54 pm, Phillip <omsdialo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> This would typically be done by the server (usually Apache)Agreed, but using Heroku means that it not an option. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Robert Walker
2010-Dec-03 19:16 UTC
Re: How to Redirect from http://mysite.com to https://www.mysite.com on Herok
Is it possible to do something similar to this little gem? Maybe implemented as Rack middleware. https://github.com/atmos/rack-redirect/blob/master/lib/rack-redirect.rb -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
shyam
2010-Dec-04 06:50 UTC
Re: Re: How to Redirect from http://mysite.com to https://www.mysite.com on Herok
Hi http://docs.heroku.com/custom-domains Have u seen this...? Thanks and regards, Shyam Mohan Ruby on rails developer at CRYPSIS <http://crypsis.net/> (Gurgaon) Email : shyam-/SZh5OcqMinR7s880joybQ@public.gmane.org Mobile : +91-971-618-9650 Web : shyam.heroku.com On Sat, Dec 4, 2010 at 12:46 AM, Robert Walker <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Is it possible to do something similar to this little gem? Maybe > implemented as Rack middleware. > > https://github.com/atmos/rack-redirect/blob/master/lib/rack-redirect.rb > > -- > Posted via http://www.ruby-forum.com/. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
shyam
2010-Dec-04 06:51 UTC
Re: How to Redirect from http://mysite.com to https://www.mysite.com on Herok
Please see this http://docs.heroku.com/custom-domains Thanks and regards, Shyam Mohan Ruby on rails developer at CRYPSIS <http://crypsis.net/> (Gurgaon) Email : shyam-/SZh5OcqMinR7s880joybQ@public.gmane.org Mobile : +91-971-618-9650 Web : shyam.heroku.com On Thu, Dec 2, 2010 at 3:14 AM, CuriousNewbie <bhellman1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello I''m looking to learn how to redirect all non-www (mysite.com) to > https://www.mysite.com > > I tried the following: > > class ApplicationController < ActionController::Base > > before_filter :check_uri > > > def check_uri > redirect_to request.protocol + "www." + request.host_with_port + > request.request_uri if !/^www/.match(request.host) if Rails.env => ''production'' > end > > > Problem with this is since the SSL cert on Heroku is for www.mysite.com, > and not mysite.com, the browser throws the nasty SSL HTTPS invalid > warning. > > Any ideas on how to redirect in a way that avoids the nasty SSL HTTPs > invalid warning? > > Thanks > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
CuriousNewbie
2010-Dec-05 00:18 UTC
Re: How to Redirect from http://mysite.com to https://www.mysite.com on Herok
Thanks Shyam, I took at a look at the link but I''m not sure how that would solve the redirect need? Still haven''t been able to figure this one out... On Dec 3, 10:51 pm, shyam <shyammohankano...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Please see this > > http://docs.heroku.com/custom-domains > > Thanks and regards, > Shyam Mohan > Ruby on rails developer at CRYPSIS <http://crypsis.net/> (Gurgaon) > Email : sh...-/SZh5OcqMinR7s880joybQ@public.gmane.org > Mobile : +91-971-618-9650 > Web : shyam.heroku.com > > > > > > > > On Thu, Dec 2, 2010 at 3:14 AM, CuriousNewbie <bhellm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hello I''m looking to learn how to redirect all non-www (mysite.com) to > >https://www.mysite.com > > > I tried the following: > > > class ApplicationController < ActionController::Base > > > before_filter :check_uri > > > def check_uri > > redirect_to request.protocol + "www." + request.host_with_port + > > request.request_uri if !/^www/.match(request.host) if Rails.env => > ''production'' > > end > > > Problem with this is since the SSL cert on Heroku is forwww.mysite.com, > > and not mysite.com, the browser throws the nasty SSL HTTPS invalid > > warning. > > > Any ideas on how to redirect in a way that avoids the nasty SSL HTTPs > > invalid warning? > > > Thanks > > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscrib e@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
CuriousNewbie
2010-Dec-07 02:43 UTC
Re: How to Redirect from http://mysite.com to https://www.mysite.com on Herok
Thanks Tim, I tried: def check_uri redirect_to "https://www.mysite.com" + request.request_uri if !/ ^www/.match(request.host) if Rails.env == ''production'' end No luck though, Chrome still shows the SSL error when you load https://mysite.com It seems to not being taking check_uri in effect early enough. Any other approaches or ideas? Heroku wasn''t able to offer any advice other than buying a wildcard cert $$$$ On Dec 2, 10:55 am, Tim Shaffer <timshaf...-BUHhN+a2lJ4@public.gmane.org> wrote:> On Dec 1, 4:44 pm, CuriousNewbie <bhellm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Any ideas on how to redirect in a way that avoids the nasty SSL HTTPs > > invalid warning? > > I have never used Heroku, but couldn''t you just use "https://" in the > redirect instead of request.protocol?-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Possibly Parallel Threads
- Rails 3 - Nested Forms, using Builder -- Check_box issue
- PGError: ERROR: invalid byte sequence for encoding "UTF8": 0xa0
- Rails - JSON object with an array?
- This installation of RMagick was configured with ImageMagick 6.6.4 but ImageMagick 6.6.5-0 is in use
- earn money 100dollar hee click mysite