How do you run Rails with HTTP locally for testing?

Our dev envs uses HTTP, prod uses HTTPS, this causes problems that we cannot reproduce locally with the associated HTTPS.

How can I run rails with SSL locally for testing purposes? Is there a webrick configuration?

thank

+5
source share
3 answers

you need to use thin :

$ sudo apt-get install thin

And add this line to config / application.rb

config.force_ssl = true

Then run the thin-language application with the command line:

$ thin start --ssl
+11
source

, Rails, rspec, , jaikoo , :

https://gist.github.com/jaikoo/daf88024b8de1cf9339b

"", , , , , - Keyur Gohil:

https://blog.botreetechnologies.com/enable-ssl-in-developement-using-thin-2a4bd1af500d

-D -V , :

#!
#  Sets up the use of SSL in development
#
# https://www.devmynd.com/blog/rails-local-development-https-using-self-signed-ssl-certificate/
#
bundle exec thin -D -V start -a localhost -p 3001 --ssl --ssl-key-file ~/development/apps/localhost_ssl_tsl_keys/localhost.key --ssl-cert-file ~/development/apps/localhost_ssl_tsl_keys/localhost.crt
+1

, SSL, . - SSL, , .

- , SSL.

-15
source

All Articles