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:
  1. 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
  1. Start rails on 443 and mentioned the same port in script:
    rvmsudo rails s -p 443
  2. 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 
Post a Comment

Popular posts from this blog

CARRIERWAVE - UPLOAD ANY MEDIA (AUDIO , VIDEO AND IMAGE ) FILE IN RAILS

RAILS: UPLOADING PHOTOS VIA AMAZON S3 AND PAPERCLIP (UPLOADING FILES TO S3 IN RUBY WITH PAPERCLIP)

SELECT COUNTRY WITH STATE AND IT'S CITIES RAILS

UNINITIALIZED CONSTANT PAPERCLIP::STORAGE::S3::AWS

HOW TO CALL RAILS API FROM SIMPLE HTML PAGE.

Building native extensions. This could take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension.

CREATE API FOR USER SIGN UP, LOGIN AND CREATE PUBLISHER WITH CURRENT USER

UPLOAD ANY MEDIA FILE IN RAILS USING PAPERCLIP