Class: Rack::Protection::ReferrerPolicy

Inherits:
Base
  • Object
show all
Defined in:
lib/rack/protection/referrer_policy.rb

Overview

Prevented attack

Secret leakage, third party tracking

Supported browsers

mixed support

More infos

www.w3.org/TR/referrer-policy/ caniuse.com/#search=referrer-policy

Sets Referrer-Policy header to tell the browser to limit the Referer header.

Options:

referrer_policy

The policy to use (default: ‘strict-origin-when-cross-origin’)

Constant Summary

Constants inherited from Base

Base::DEFAULT_OPTIONS

Instance Attribute Summary

Attributes inherited from Base

#app, #options

Instance Method Summary collapse

Methods inherited from Base

#accepts?, #debug, #default_options, default_options, default_reaction, #deny, #drop_session, #encrypt, #html?, #initialize, #instrument, #origin, #random_string, #react, #referrer, #report, #safe?, #secure_compare, #session, #session?, #warn

Constructor Details

This class inherits a constructor from Rack::Protection::Base

Instance Method Details

#call(env) ⇒ Object



20
21
22
23
24
# File 'lib/rack/protection/referrer_policy.rb', line 20

def call(env)
  status, headers, body = @app.call(env)
  headers['referrer-policy'] ||= options[:referrer_policy]
  [status, headers, body]
end