jeudi 9 juin 2016

URL redirection in rails

I have configured SSL in by application example.com and I am also using ELB that acts as the proxy server to the application. Now if someone hits www.example.com, I want it(www.example.com) to be redirected to example.com and also SSL should work.

For that I have done the following in my routes file:

constraints(:host => /www.example.org/) do
  match "/(*path)" => redirect {|params, req| "http://ift.tt/1U9RJFo]}"}
end

With the above code the redirection is happening properly but the issue is coming for the first time when I hit www.example.org. I am getting SSL issue for www.example.org. If I click advanced then its working. But I don't want this screen to come.

Aucun commentaire:

Enregistrer un commentaire