Class: RemoveHsts::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/remove_hsts/middleware.rb

Overview

This is a RACK middleware that removes HSTS header from the response. Rails automatically adds HSTS header for any SSL request and it couldn’t be disabled. But we don’t need this header, because in our stack it will be added by nginx.

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Middleware

Returns a new instance of Middleware.



7
8
9
# File 'lib/remove_hsts/middleware.rb', line 7

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
# File 'lib/remove_hsts/middleware.rb', line 11

def call(env)
  @app.call(env).tap do |status, headers, body|
    headers.delete('Strict-Transport-Security'.freeze)
  end
end