Class: ActionDispatch::AssumeSSL
- Defined in:
- actionpack/lib/action_dispatch/middleware/assume_ssl.rb
Overview
When proxying through a load balancer that terminates SSL, the forwarded request will appear as though its HTTP instead of HTTPS to the application. This makes redirects and cookie security target HTTP instead of HTTPS. This middleware makes the server assume that the proxy already terminated SSL, and that the request really is HTTPS.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ AssumeSSL
constructor
A new instance of AssumeSSL.
Constructor Details
#initialize(app) ⇒ AssumeSSL
Returns a new instance of AssumeSSL.
9 10 11 |
# File 'actionpack/lib/action_dispatch/middleware/assume_ssl.rb', line 9 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'actionpack/lib/action_dispatch/middleware/assume_ssl.rb', line 13 def call(env) env["HTTPS"] = "on" env["HTTP_X_FORWARDED_PORT"] = 443 env["HTTP_X_FORWARDED_PROTO"] = "https" env["rack.url_scheme"] = "https" @app.call(env) end |