I transfer the application to the hero, and I am having problems with ssl and redirects.
I am on rails 3.1 and I tried to force ssl with middleware in production.rb environments. I kept trying to add it to the application controller.
The problem is that when I execute the full ssl command, I cannot redirect to www before it reaches the SSL requirement. This is important because the user will be shown a bad SSL certificate warning if they access https://mydomain.com . If they continue, they are then redirected to www.
Enables SSL-forcing, redirecting to the www subdomain works, I just need to redirect first.
Any ideas?
Per Nathan Comment:
I had an imperfect solution. My root_path does not force ssl. All parts with sensitive information force it. Upon arrival, all traffic is directed to www with this in my routes. Rb:
constraints(:host => "domain.com") do match "(*x)" => redirect { |params, request| URI.parse(request.url).tap { |x| x.host = "www.domain.com" }.to_s } end
This can hide most of the problems, since by the time the user clicked on an entry or something else, they were now in the www domain. The browser will not warn about certificates. This worked great for this specific project. Another project that I ended up paying a lot of money for a signed wild card certificate.
Sorry, not a real solution. If you go to https://domain.com/forcedsslpath , the project still provides security warnings.
Kombo
source share