Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed that SSL would not correctly be detected when running lighttpd/…

…fcgi behind lighttpd w/mod_proxy (closes #3548) [stephen_purcell@yahoo.com]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3467 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 010e999092c04bd5ef9185db284a8733bc1b6ee6 1 parent c3cfc26
@dhh dhh authored
View
2  actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fixed that SSL would not correctly be detected when running lighttpd/fcgi behind lighttpd w/mod_proxy #3548 [stephen_purcell@yahoo.com]
+
* Added the possibility to specify atomatic expiration for the memcachd session container #3571 [Stefan Kaes]
* Change layout discovery to take into account the change in semantics with File.join and nil arguments. [Marcel Molina Jr.]
View
2  actionpack/lib/action_controller/request.rb
@@ -153,7 +153,7 @@ def protocol
# Is this an SSL request?
def ssl?
- env['HTTPS'] == 'on'
+ env['HTTPS'] == 'on' || env['HTTP_X_FORWARDED_PROTO'] == 'https'
end
# Returns the interpreted path to requested resource after all the installation directory of this application was taken into account
View
12 actionpack/test/controller/request_test.rb
@@ -237,5 +237,17 @@ def test_xml_http_request
assert @request.xml_http_request?
assert @request.xhr?
end
+
+ def test_reports_ssl
+ assert !@request.ssl?
+ @request.env['HTTPS'] = 'on'
+ assert @request.ssl?
+ end
+
+ def test_reports_ssl_when_proxied_via_lighttpd
+ assert !@request.ssl?
+ @request.env['HTTP_X_FORWARDED_PROTO'] = 'https'
+ assert @request.ssl?
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.