pub enum ReferrerPolicy {
NoReferrer,
NoReferrerWhenDowngrade,
Origin,
OriginWhenCrossOrigin,
SameOrigin,
StrictOrigin,
StrictOriginWhenCrossOrigin,
UnsafeUrl,
}
Expand description
Manages Referrer-Policy
header
The Referrer-Policy HTTP response header controls how much referrer information (sent via the Referer header) should be included with requests.
§Values
- no-referrer: The Referer header will be omitted entirely. No referrer information is sent along with requests.
- no-referrer-when-downgrade: The Referer header will be omitted entirely. However, if the protected resource URL scheme is HTTPS, then the full path will still be sent as a referrer.
- origin: Only send the origin of the document as the referrer in all cases. The document https://example.com/page.html will send the referrer https://example.com/.
- origin-when-cross-origin: Send a full URL when performing a same-origin request, but only send the origin of the document for other cases.
- same-origin: A referrer will be sent for same-site origins, but cross-origin requests will contain no referrer information.
- strict-origin: Only send the origin of the document as the referrer when the protocol security level stays the same (HTTPS→HTTPS), but don’t send it to a less secure destination (HTTPS→HTTP).
- strict-origin-when-cross-origin: Send a full URL when performing a same-origin request, only send the origin when the protocol security level stays the same (HTTPS→HTTPS), and send no header to a less secure destination (HTTPS→HTTP).
- unsafe-url: Send a full URL (stripped from parameters) when performing a same-origin or cross-origin request. This policy will leak origins and paths from TLS-protected resources to insecure origins. Carefully consider the impact of this setting.
§Examples
use helmet_core::ReferrerPolicy;
let referrer_policy = ReferrerPolicy::no_referrer();
Variants§
NoReferrer
NoReferrerWhenDowngrade
Origin
OriginWhenCrossOrigin
SameOrigin
StrictOrigin
StrictOriginWhenCrossOrigin
UnsafeUrl
Implementations§
Source§impl ReferrerPolicy
impl ReferrerPolicy
pub fn no_referrer() -> Self
pub fn no_referrer_when_downgrade() -> Self
pub fn origin() -> Self
pub fn origin_when_cross_origin() -> Self
pub fn same_origin() -> Self
pub fn strict_origin() -> Self
pub fn strict_origin_when_cross_origin() -> Self
pub fn unsafe_url() -> Self
Trait Implementations§
Source§impl Clone for ReferrerPolicy
impl Clone for ReferrerPolicy
Source§fn clone(&self) -> ReferrerPolicy
fn clone(&self) -> ReferrerPolicy
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for ReferrerPolicy
impl RefUnwindSafe for ReferrerPolicy
impl Send for ReferrerPolicy
impl Sync for ReferrerPolicy
impl Unpin for ReferrerPolicy
impl UnwindSafe for ReferrerPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more