RUN RAILS SERVER ON PORT 443
If we want to run the rails application in port 443 :-
I have added the below line in /config/environments/production.rb:
config.force_ssl = true
Now I have tried the below attempts:
- Start rails on 3000
SSL=true rails s -e production -p 3000
It runs rails on https://project.com but 404 error on http://project.com
- Start rails on 443 and mentioned the same port in script:
rvmsudo rails s -p 443
- Start rails on 80 and 443 both using two different pid:
rvmsudo rails s -p 80 -P PID1
rvmsudo rails s -p 443 -P PID2
4.Finally I have tried to forward request to 3000 from 443 and 80:
sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3000
sudo iptables -t nat -I PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 3000
We can also follow the link below :-
https://stackoverflow.com/questions/27560744/run-rails-on-secure-https-and-redirect-non-securehttp-request-to-secure-thro
Comments