简体   繁体   中英

Rails/Nginx redirects http to https

I'm using Rails, Nginx, and Unicorn to try and get a small intranet app up and running. I've closely followed this tutorial (everything except PostgreSQL) and it worked great for a sample app I built, but moving it over to the app I previously wrote, I ran into some problems.

Somewhere, I've told Rails (or Nginx) to use SSL. I've dug through all sorts of files: config/environments/, config/application, config/unicorn.rb, Unicorn init script (same as tutorial's), Nginx init script (same as tutorial's), and everything in between, but haven't found any signs of SSL or HTTPS.

The only way I can get it to work is if I launch the server locally in development with rails s -e development , open up a brand new private window in Firefox, and type in http://localhost:3000 . Even if I run the server locally in production, I get the Server connection failed, (Error code: ssl_error_rx_record_too_long) message because it's trying to connect using SSL and the server doesn't like it.

Trying to connect using just the IP address also results in the SSL error because it changes the URL to include HTTPS.

您可以在nginx配置文件中配置此强制重定向。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM