Class: SignalWire::SWML::Service::SecurityHeadersMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/signalwire/swml/service.rb

Overview


Middleware: security headers


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) ⇒ SecurityHeadersMiddleware

Returns a new instance of SecurityHeadersMiddleware.



588
589
590
# File 'lib/signalwire/swml/service.rb', line 588

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



592
593
594
595
596
# File 'lib/signalwire/swml/service.rb', line 592

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