Enum HeadersReferrerPolicy

java.lang.Object
java.lang.Enum<HeadersReferrerPolicy>
software.amazon.awscdk.services.cloudfront.HeadersReferrerPolicy
All Implemented Interfaces:
Serializable, Comparable<HeadersReferrerPolicy>, java.lang.constant.Constable

@Generated(value="jsii-pacmak/1.94.0 (build b380f01)", date="2024-03-01T20:58:20.892Z") @Stability(Stable) public enum HeadersReferrerPolicy extends Enum<HeadersReferrerPolicy>
Enum representing possible values of the Referrer-Policy HTTP response header.

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())
         .removeHeaders(List.of("Server"))
         .serverTimingSamplingRate(50)
         .build();
 Distribution.Builder.create(this, "myDistCustomPolicy")
         .defaultBehavior(BehaviorOptions.builder()
                 .origin(bucketOrigin)
                 .responseHeadersPolicy(myResponseHeadersPolicy)
                 .build())
         .build();
 
  • Enum Constant Details

    • NO_REFERRER

      @Stability(Stable) public static final HeadersReferrerPolicy NO_REFERRER
      The referrer policy is not set.
    • NO_REFERRER_WHEN_DOWNGRADE

      @Stability(Stable) public static final HeadersReferrerPolicy NO_REFERRER_WHEN_DOWNGRADE
      The referrer policy is no-referrer-when-downgrade.
    • ORIGIN

      @Stability(Stable) public static final HeadersReferrerPolicy ORIGIN
      The referrer policy is origin.
    • ORIGIN_WHEN_CROSS_ORIGIN

      @Stability(Stable) public static final HeadersReferrerPolicy ORIGIN_WHEN_CROSS_ORIGIN
      The referrer policy is origin-when-cross-origin.
    • SAME_ORIGIN

      @Stability(Stable) public static final HeadersReferrerPolicy SAME_ORIGIN
      The referrer policy is same-origin.
    • STRICT_ORIGIN

      @Stability(Stable) public static final HeadersReferrerPolicy STRICT_ORIGIN
      The referrer policy is strict-origin.
    • STRICT_ORIGIN_WHEN_CROSS_ORIGIN

      @Stability(Stable) public static final HeadersReferrerPolicy STRICT_ORIGIN_WHEN_CROSS_ORIGIN
      The referrer policy is strict-origin-when-cross-origin.
    • UNSAFE_URL

      @Stability(Stable) public static final HeadersReferrerPolicy UNSAFE_URL
      The referrer policy is unsafe-url.
  • Method Details

    • values

      public static HeadersReferrerPolicy[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static HeadersReferrerPolicy valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null