Class: SignalWire::AgentBase::AgentSecurityHeadersMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/signalwire/agent/agent_base.rb

Overview

Rack Middleware

Constant Summary collapse

HEADERS =
{
  'x-content-type-options' => 'nosniff',
  'x-frame-options'        => 'DENY',
  'cache-control'          => 'no-store, no-cache, must-revalidate'
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ AgentSecurityHeadersMiddleware

Returns a new instance of AgentSecurityHeadersMiddleware.



2069
2070
2071
# File 'lib/signalwire/agent/agent_base.rb', line 2069

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



2073
2074
2075
2076
2077
# File 'lib/signalwire/agent/agent_base.rb', line 2073

def call(env)
  status, headers, body = @app.call(env)
  HEADERS.each { |k, v| headers[k] = v }
  [status, headers, body]
end