SSL website in rails forwards me to a url with port 443 suffix
First off, this is my first SSL web application so I might be doing something horribly wrong. We turned on SSL per request from a client on https://bla.be/
It seemed to work out of the box. We ordered web hosting with SSL and we didn't seem to have to do any configuration.
However 2 problems arose:
- Whenever I click certain links (and it really seems random as to which ones) it deforms the url prefix from HTTPS to HTTP and adds a port :443 suffix at the end of the domain name. Resulting in links that do not work. (ex.: https://bla.com/view/3 becomes http://bla.com:443/view/3)
It always does this when I download a file through sendfile:
send_file datafile.document.path, :type => datafile.document_content_type, :disposition => 'attachment', :x_sendfile => true
I tried adding :secure => true to links but that doesn't seem to do anything.
Am I forgetting some开发者_Go百科 required configuration? Or is my host's setup wrong?
Thanks in advance.
It sounds like you're specifying the :port option on your URL generation instead of the :protocol. You want to switch to the https protocol, not specify the SSL port.
If you're using a library/gem for this, it's not working correctly.
I'd recommend the ssl_requirement plugin.
Are you using the correct help-method for your url's?
I had a similar problem and I solved it by changing the blabla_url to blabla_path.
精彩评论