@Generated(value="jsii-pacmak/1.50.0 (build d1830a4)", date="2022-01-11T17:58:48.812Z") @Stability(value=Stable) public enum HeadersReferrerPolicy extends Enum<HeadersReferrerPolicy>
Example:
// Using an existing managed response headers policy
S3Origin bucketOrigin;
Distribution.Builder.create(this, "myDistManagedPolicy")
.defaultBehavior(BehaviorOptions.builder()
.origin(bucketOrigin)
.responseHeadersPolicy(ResponseHeadersPolicy.CORS_ALLOW_ALL_ORIGINS)
.build())
.build();
// Creating a custom response headers policy -- all parameters optional
ResponseHeadersPolicy myResponseHeadersPolicy = ResponseHeadersPolicy.Builder.create(this, "ResponseHeadersPolicy")
.responseHeadersPolicyName("MyPolicy")
.comment("A default policy")
.corsBehavior(ResponseHeadersCorsBehavior.builder()
.accessControlAllowCredentials(false)
.accessControlAllowHeaders(List.of("X-Custom-Header-1", "X-Custom-Header-2"))
.accessControlAllowMethods(List.of("GET", "POST"))
.accessControlAllowOrigins(List.of("*"))
.accessControlExposeHeaders(List.of("X-Custom-Header-1", "X-Custom-Header-2"))
.accessControlMaxAge(Duration.seconds(600))
.originOverride(true)
.build())
.customHeadersBehavior(ResponseCustomHeadersBehavior.builder()
.customHeaders(List.of(ResponseCustomHeader.builder().header("X-Amz-Date").value("some-value").override(true).build(), ResponseCustomHeader.builder().header("X-Amz-Security-Token").value("some-value").override(false).build()))
.build())
.securityHeadersBehavior(ResponseSecurityHeadersBehavior.builder()
.contentSecurityPolicy(ResponseHeadersContentSecurityPolicy.builder().contentSecurityPolicy("default-src https:;").override(true).build())
.contentTypeOptions(ResponseHeadersContentTypeOptions.builder().override(true).build())
.frameOptions(ResponseHeadersFrameOptions.builder().frameOption(HeadersFrameOption.DENY).override(true).build())
.referrerPolicy(ResponseHeadersReferrerPolicy.builder().referrerPolicy(HeadersReferrerPolicy.NO_REFERRER).override(true).build())
.strictTransportSecurity(ResponseHeadersStrictTransportSecurity.builder().accessControlMaxAge(Duration.seconds(600)).includeSubdomains(true).override(true).build())
.xssProtection(ResponseHeadersXSSProtection.builder().protection(true).modeBlock(true).reportUri("https://example.com/csp-report").override(true).build())
.build())
.build();
Distribution.Builder.create(this, "myDistCustomPolicy")
.defaultBehavior(BehaviorOptions.builder()
.origin(bucketOrigin)
.responseHeadersPolicy(myResponseHeadersPolicy)
.build())
.build();
| Enum Constant and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
static HeadersReferrerPolicy |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static HeadersReferrerPolicy[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
@Stability(value=Stable) public static final HeadersReferrerPolicy NO_REFERRER
@Stability(value=Stable) public static final HeadersReferrerPolicy NO_REFERRER_WHEN_DOWNGRADE
@Stability(value=Stable) public static final HeadersReferrerPolicy ORIGIN
@Stability(value=Stable) public static final HeadersReferrerPolicy ORIGIN_WHEN_CROSS_ORIGIN
@Stability(value=Stable) public static final HeadersReferrerPolicy SAME_ORIGIN
@Stability(value=Stable) public static final HeadersReferrerPolicy STRICT_ORIGIN
@Stability(value=Stable) public static final HeadersReferrerPolicy STRICT_ORIGIN_WHEN_CROSS_ORIGIN
@Stability(value=Stable) public static final HeadersReferrerPolicy UNSAFE_URL
public static HeadersReferrerPolicy[] values()
for (HeadersReferrerPolicy c : HeadersReferrerPolicy.values()) System.out.println(c);
public static HeadersReferrerPolicy valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullCopyright © 2022. All rights reserved.