I'm using the Thin web server to serve my Rails app.
thin start
serves http
requests.thin start --ssl
serves https
requests.Is there a way to have thin
serve both http
and https
requests concurrently?
The reason I ask is because when I use redirect_to some_path
in my controllers, they redirect to http
. Since thin
is serving https
requests, nothing is rendered.
Note: I'm using Rack::SSL
in Rails 3.0.7
.
(Comment converted to answer as requested.)
Simplest option is probably to run two separate instances of thin: one accepting SSL requests and one accepting plaintext requests. Any reason you don't want to do this? (Alternatively, if thin is running behind another web server, like Apache or Nginx, you only need one instance of thin: the frontend server can report whether the request came in over SSL.)
You can't accept both HTTP and HTTPS connections on the same port. (This is why, by default convention, HTTP runs on port 80 whereas HTTPS runs on port 443.)
you can use foreman (https://github.com/ddollar/foreman);
You create a Procfile with 2 process then start both with forman start
command.
put this on a file called Procfile
:
web: thin start
ssl: thin start --ssl
Then use foreman start
and he start the 2 process.
This is how i am using... hope this helps you!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With