Sha256: 956f0d68d833923c03cefbceccd6fb54ca36f3d1728e66c78541ba8e777f1960

Contents?: true

Size: 748 Bytes

Versions: 20

Compression:

Stored size: 748 Bytes

Contents

# frozen_string_literal: true

# :markup: markdown

module ActionDispatch
  # # Action Dispatch AssumeSSL
  #
  # When proxying through a load balancer that terminates SSL, the forwarded
  # request will appear as though it's 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.
  class AssumeSSL
    def initialize(app)
      @app = app
    end

    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
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
actionpack-8.0.0 lib/action_dispatch/middleware/assume_ssl.rb
actionpack-7.2.2 lib/action_dispatch/middleware/assume_ssl.rb
actionpack-8.0.0.rc2 lib/action_dispatch/middleware/assume_ssl.rb
actionpack-7.2.1.2 lib/action_dispatch/middleware/assume_ssl.rb
actionpack-8.0.0.rc1 lib/action_dispatch/middleware/assume_ssl.rb
actionpack-7.2.1.1 lib/action_dispatch/middleware/assume_ssl.rb
actionpack-8.0.0.beta1 lib/action_dispatch/middleware/assume_ssl.rb
omg-actionpack-8.0.0.alpha9 lib/action_dispatch/middleware/assume_ssl.rb
omg-actionpack-8.0.0.alpha8 lib/action_dispatch/middleware/assume_ssl.rb
omg-actionpack-8.0.0.alpha7 lib/action_dispatch/middleware/assume_ssl.rb
omg-actionpack-8.0.0.alpha4 lib/action_dispatch/middleware/assume_ssl.rb
omg-actionpack-8.0.0.alpha3 lib/action_dispatch/middleware/assume_ssl.rb
omg-actionpack-8.0.0.alpha2 lib/action_dispatch/middleware/assume_ssl.rb
omg-actionpack-8.0.0.alpha1 lib/action_dispatch/middleware/assume_ssl.rb
actionpack-7.2.1 lib/action_dispatch/middleware/assume_ssl.rb
actionpack-7.2.0 lib/action_dispatch/middleware/assume_ssl.rb
actionpack-7.2.0.rc1 lib/action_dispatch/middleware/assume_ssl.rb
actionpack-7.2.0.beta3 lib/action_dispatch/middleware/assume_ssl.rb
actionpack-7.2.0.beta2 lib/action_dispatch/middleware/assume_ssl.rb
actionpack-7.2.0.beta1 lib/action_dispatch/middleware/assume_ssl.rb