Class HeadersReferrerPolicy
Enum representing possible values of the Referrer-Policy HTTP response header.
Inheritance
System.Object
HeadersReferrerPolicy
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public sealed class HeadersReferrerPolicy : Enum
Syntax (vb)
Public NotInheritable Class HeadersReferrerPolicy
Inherits
Enum
Remarks
ExampleMetadata: infused
Examples
// Using an existing managed response headers policy
S3Origin bucketOrigin;
new Distribution(this, "myDistManagedPolicy", new DistributionProps {
DefaultBehavior = new BehaviorOptions {
Origin = bucketOrigin,
ResponseHeadersPolicy = ResponseHeadersPolicy.CORS_ALLOW_ALL_ORIGINS
}
});
// Creating a custom response headers policy -- all parameters optional
var myResponseHeadersPolicy = new ResponseHeadersPolicy(this, "ResponseHeadersPolicy", new ResponseHeadersPolicyProps {
ResponseHeadersPolicyName = "MyPolicy",
Comment = "A default policy",
CorsBehavior = new ResponseHeadersCorsBehavior {
AccessControlAllowCredentials = false,
AccessControlAllowHeaders = new [] { "X-Custom-Header-1", "X-Custom-Header-2" },
AccessControlAllowMethods = new [] { "GET", "POST" },
AccessControlAllowOrigins = new [] { "*" },
AccessControlExposeHeaders = new [] { "X-Custom-Header-1", "X-Custom-Header-2" },
AccessControlMaxAge = Duration.Seconds(600),
OriginOverride = true
},
CustomHeadersBehavior = new ResponseCustomHeadersBehavior {
CustomHeaders = new [] { new ResponseCustomHeader { Header = "X-Amz-Date", Value = "some-value", Override = true }, new ResponseCustomHeader { Header = "X-Amz-Security-Token", Value = "some-value", Override = false } }
},
SecurityHeadersBehavior = new ResponseSecurityHeadersBehavior {
ContentSecurityPolicy = new ResponseHeadersContentSecurityPolicy { ContentSecurityPolicy = "default-src https:;", Override = true },
ContentTypeOptions = new ResponseHeadersContentTypeOptions { Override = true },
FrameOptions = new ResponseHeadersFrameOptions { FrameOption = HeadersFrameOption.DENY, Override = true },
ReferrerPolicy = new ResponseHeadersReferrerPolicy { ReferrerPolicy = HeadersReferrerPolicy.NO_REFERRER, Override = true },
StrictTransportSecurity = new ResponseHeadersStrictTransportSecurity { AccessControlMaxAge = Duration.Seconds(600), IncludeSubdomains = true, Override = true },
XssProtection = new ResponseHeadersXSSProtection { Protection = true, ModeBlock = false, ReportUri = "https://example.com/csp-report", Override = true }
},
RemoveHeaders = new [] { "Server" },
ServerTimingSamplingRate = 50
});
new Distribution(this, "myDistCustomPolicy", new DistributionProps {
DefaultBehavior = new BehaviorOptions {
Origin = bucketOrigin,
ResponseHeadersPolicy = myResponseHeadersPolicy
}
});
Synopsis
Fields
NO_REFERRER | The referrer policy is not set. |
NO_REFERRER_WHEN_DOWNGRADE | The referrer policy is no-referrer-when-downgrade. |
ORIGIN | The referrer policy is origin. |
ORIGIN_WHEN_CROSS_ORIGIN | The referrer policy is origin-when-cross-origin. |
SAME_ORIGIN | The referrer policy is same-origin. |
STRICT_ORIGIN | The referrer policy is strict-origin. |
STRICT_ORIGIN_WHEN_CROSS_ORIGIN | The referrer policy is strict-origin-when-cross-origin. |
UNSAFE_URL | The referrer policy is unsafe-url. |
value__ |
Fields
NO_REFERRER
The referrer policy is not set.
public const HeadersReferrerPolicy NO_REFERRER
Field Value
Type | Description |
---|---|
HeadersReferrerPolicy |
NO_REFERRER_WHEN_DOWNGRADE
The referrer policy is no-referrer-when-downgrade.
public const HeadersReferrerPolicy NO_REFERRER_WHEN_DOWNGRADE
Field Value
Type | Description |
---|---|
HeadersReferrerPolicy |
ORIGIN
The referrer policy is origin.
public const HeadersReferrerPolicy ORIGIN
Field Value
Type | Description |
---|---|
HeadersReferrerPolicy |
ORIGIN_WHEN_CROSS_ORIGIN
The referrer policy is origin-when-cross-origin.
public const HeadersReferrerPolicy ORIGIN_WHEN_CROSS_ORIGIN
Field Value
Type | Description |
---|---|
HeadersReferrerPolicy |
SAME_ORIGIN
The referrer policy is same-origin.
public const HeadersReferrerPolicy SAME_ORIGIN
Field Value
Type | Description |
---|---|
HeadersReferrerPolicy |
STRICT_ORIGIN
The referrer policy is strict-origin.
public const HeadersReferrerPolicy STRICT_ORIGIN
Field Value
Type | Description |
---|---|
HeadersReferrerPolicy |
STRICT_ORIGIN_WHEN_CROSS_ORIGIN
The referrer policy is strict-origin-when-cross-origin.
public const HeadersReferrerPolicy STRICT_ORIGIN_WHEN_CROSS_ORIGIN
Field Value
Type | Description |
---|---|
HeadersReferrerPolicy |
UNSAFE_URL
The referrer policy is unsafe-url.
public const HeadersReferrerPolicy UNSAFE_URL
Field Value
Type | Description |
---|---|
HeadersReferrerPolicy |
value__
public int value__
Field Value
Type | Description |
---|---|
System.Int32 |