class Kemal::Shield::ReferrerPolicy

Overview

Kemal::Shield::ReferrerPolicy is a handler that sets the Referrer-Policy HTTP header.

The default value is "no-referrer".

A custom Referrer-Policy policy can be set by setting

Kemal::Shield.config.referrer_policy

Example

Kemal::Shield.config.referrer_policy = ["same-origin", "origin", "strict-origin"]

This will set the Referrer-Policy policy to "same-origin,origin,strict-origin".

Valid policies:

"no-referrer"
"no-referrer-when-downgrade"
"same-origin"
"origin"
"strict-origin"
"origin-when-cross-origin"
"strict-origin-when-cross-origin"
"unsafe-url"

Defined in:

kemal-shield/handlers/referrer_policy.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(policy_tokens : Array(String) = ["no-referrer"]) #

[View source]

Instance Method Detail

def call(context) #

[View source]