I have a rails application that I built on Heroku and I configured it to use SSL. Now I'm moving to AWS EC2, and I want the version of my application to work without SSL. After that I will add the SSL function later.
My stack is Puma + Nginx + PostgreSQL, and I work with Rails 4.2.4, Ruby 2.2.3 and Capistrano 3.4.0.
I remember in my application that I once inserted a row
config.force_ssl = true
in config / environment / production.rb. I commented on this, expecting my application to return to working with http. But this is not so: even after commenting on this line, whenever I visit my EC2 IP address (52.35.82.113), the request is sent to port 80 (http) and redirected to port 443 (https).
This can be seen more clearly when I run curl -v http://localhost in my EC2 instance, which it returns:
* Rebuilt URL to: http://localhost/ * Hostname was NOT found in DNS cache * Trying 127.0.0.1... * Connected to localhost (127.0.0.1) port 80 (#0) > GET / HTTP/1.1 > User-Agent: curl/7.35.0 > Host: localhost > Accept: */* > < HTTP/1.1 301 Moved Permanently * Server nginx/1.4.6 (Ubuntu) is not blacklisted < Server: nginx/1.4.6 (Ubuntu) < Date: Sat, 12 Dec 2015 12:22:56 GMT < Content-Type: text/html < Transfer-Encoding: chunked < Connection: keep-alive < Location: https://localhost/ < * Connection #0 to host localhost left intact
I am not very experienced when it comes to this. At first I thought there was a problem with my Nginx configuration, in my previous question here I was asked that there was nothing wrong with my Nginx configuration and that the redirect was from Rails. I suspect this is because I don't see anything in Nginx that could provide a redirect, but if you think the problem might be there, you can see a lot of relevant code in the link above.
What else in Rails, besides the above force_ssl, can cause a redirect?
Thanks for all your help. Let me know if you have any questions or need more information!
source share