Rails SSL issue: (https://example.com) didn't match request.base_url (http://example.com)

后端 未结 3 1139
感动是毒
感动是毒 2021-02-13 10:51

I just installed an SSL certificate on my site. Unfortunately it has broken the login functionality. After submitting the login form on the site it just redirects to the home pa

3条回答
  •  梦如初夏
    2021-02-13 11:28

    Just run in to the same error. In config/environments/production.rb make sure you have set:

    config.force_ssl = true
    

    While not strictly related to this issue, after setting this setting you will need to ensure that your reverse proxy (if you have one) is set up to forward the protocol used to rails by sending the X-Forwarded-Proto header from the proxy to rails. The way this is done depends on which reverse proxy you use (Apache, nginx, etc) and how you have configured it so it's best you look up the specific documentation for the reverse proxy you are using.

提交回复
热议问题