Ruby on rails: force_ssl not redirecting from http to https when using thin start --ssl

前端 未结 5 1625
生来不讨喜
生来不讨喜 2021-01-21 03:49

I have been trying to configure my rails project to use SSL (as application wide) with thin (by adding thin gem and placing config.force_ssl = true to applica

相关标签:
5条回答
  • 2021-01-21 04:17

    Your PC as (localhost) can self sign SSL certificate and your browser can accept it, but i think that browser will not automatically accept certificate with security on that layer. Maybe to try to add your localhost certificate to the browser ?

    0 讨论(0)
  • 2021-01-21 04:24

    Here is the simplest solution.

    https://makandracards.com/makandra/15903-using-thin-for-development-with-ssl

    0 讨论(0)
  • 2021-01-21 04:30

    Use ngrok (https://ngrok.com/). It's free. Installation is easy.

    Just start up your server, then in another terminal window run

    ngrok http 3000
    

    ngrok will give you an address that loops back to your dev machine - something like http://randomstringhere.ngrok.io

    Put that in your browser and you'll see it redirect to https://randomstringhere.ngrok.io, still routing to your server on port 3000

    0 讨论(0)
  • 2021-01-21 04:34

    You should install your own openssl signed certificate. You can find more information on this page

    0 讨论(0)
  • 2021-01-21 04:42

    Verify config/environments/development.rb has the following line

    config.force_ssl = true

    Refer the post thin with ssl support and ruby debug and the responses(from nathan and shree) that has more information on this subject:

    0 讨论(0)
提交回复
热议问题