400 Bad Request: The plain HTTP request was sent to HTTPS port

| | Comments (0) | TrackBacks (0)
If you find your Rails application behaving a little bit "schizophrenic" regarding HTTP and HTTPS, and you are using Nginx as proxy in front of your Mongrel or Thin servers,  then is possible that you are suffering a lack of headers.

This disease is easily cured by the administration of a single dosis of:

proxy_set_header X_FORWARDED_PROTO https;

To your nginx.conf. Off course this treatment is only recommended for SSL enabled configurations.

Basically the problem is that if the header is not set, the Rails application doesn't know that the request is HTTPS, and responds with a regular HTTP response. Depending on your configuration and what are you doing with your application the problem can not arise until you get a somethinbg like a HTTP redirect from your application hitting the wrong port (443)

0 TrackBacks

Listed below are links to blogs that reference this entry: 400 Bad Request: The plain HTTP request was sent to HTTPS port.

TrackBack URL for this entry: http://www.hasmanydevelopers.com/cgi-bin/mt/mt-tb.cgi/9

Leave a comment

About this Entry

This page contains a single entry by Aníbal Rojas published on December 10, 2008 4:47 PM.

Metting Merb and helping it to be even more cooler... was the previous entry in this blog.

rdiff-backup: Warning: Local version 1.1.14 does not match remote version 1.1.15. is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.