aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/CHANGELOG2
-rwxr-xr-xactionpack/lib/action_controller/request.rb2
-rw-r--r--actionpack/test/controller/request_test.rb12
3 files changed, 15 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 1772841969..bf00979083 100644
--- a/actionpack/CHANGELOG
+++ b/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.]
diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb
index 7203f4b789..8b5c480626 100755
--- a/actionpack/lib/action_controller/request.rb
+++ b/actionpack/lib/action_controller/request.rb
@@ -153,7 +153,7 @@ module ActionController
# 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
diff --git a/actionpack/test/controller/request_test.rb b/actionpack/test/controller/request_test.rb
index f941857c48..a7623f3403 100644
--- a/actionpack/test/controller/request_test.rb
+++ b/actionpack/test/controller/request_test.rb
@@ -237,5 +237,17 @@ class RequestTest < Test::Unit::TestCase
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