Class CfnResponseHeadersPolicy
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.cloudfront.CfnResponseHeadersPolicy
- All Implemented Interfaces:
IInspectable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)",
date="2024-10-05T03:43:39.968Z")
@Stability(Stable)
public class CfnResponseHeadersPolicy
extends CfnResource
implements IInspectable
A response headers policy.
A response headers policy contains information about a set of HTTP response headers.
After you create a response headers policy, you can use its ID to attach it to one or more cache behaviors in a CloudFront distribution. When it's attached to a cache behavior, the response headers policy affects the HTTP headers that CloudFront includes in HTTP responses to requests that match the cache behavior. CloudFront adds or removes response headers according to the configuration of the response headers policy.
For more information, see Adding or removing HTTP headers in CloudFront responses in the Amazon CloudFront Developer Guide .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.services.cloudfront.*; CfnResponseHeadersPolicy cfnResponseHeadersPolicy = CfnResponseHeadersPolicy.Builder.create(this, "MyCfnResponseHeadersPolicy") .responseHeadersPolicyConfig(ResponseHeadersPolicyConfigProperty.builder() .name("name") // the properties below are optional .comment("comment") .corsConfig(CorsConfigProperty.builder() .accessControlAllowCredentials(false) .accessControlAllowHeaders(AccessControlAllowHeadersProperty.builder() .items(List.of("items")) .build()) .accessControlAllowMethods(AccessControlAllowMethodsProperty.builder() .items(List.of("items")) .build()) .accessControlAllowOrigins(AccessControlAllowOriginsProperty.builder() .items(List.of("items")) .build()) .originOverride(false) // the properties below are optional .accessControlExposeHeaders(AccessControlExposeHeadersProperty.builder() .items(List.of("items")) .build()) .accessControlMaxAgeSec(123) .build()) .customHeadersConfig(CustomHeadersConfigProperty.builder() .items(List.of(CustomHeaderProperty.builder() .header("header") .override(false) .value("value") .build())) .build()) .removeHeadersConfig(RemoveHeadersConfigProperty.builder() .items(List.of(RemoveHeaderProperty.builder() .header("header") .build())) .build()) .securityHeadersConfig(SecurityHeadersConfigProperty.builder() .contentSecurityPolicy(ContentSecurityPolicyProperty.builder() .contentSecurityPolicy("contentSecurityPolicy") .override(false) .build()) .contentTypeOptions(ContentTypeOptionsProperty.builder() .override(false) .build()) .frameOptions(FrameOptionsProperty.builder() .frameOption("frameOption") .override(false) .build()) .referrerPolicy(ReferrerPolicyProperty.builder() .override(false) .referrerPolicy("referrerPolicy") .build()) .strictTransportSecurity(StrictTransportSecurityProperty.builder() .accessControlMaxAgeSec(123) .override(false) // the properties below are optional .includeSubdomains(false) .preload(false) .build()) .xssProtection(XSSProtectionProperty.builder() .override(false) .protection(false) // the properties below are optional .modeBlock(false) .reportUri("reportUri") .build()) .build()) .serverTimingHeadersConfig(ServerTimingHeadersConfigProperty.builder() .enabled(false) // the properties below are optional .samplingRate(123) .build()) .build()) .build();
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
A list of HTTP header names that CloudFront includes as values for theAccess-Control-Allow-Headers
HTTP response header.static interface
A list of HTTP methods that CloudFront includes as values for theAccess-Control-Allow-Methods
HTTP response header.static interface
A list of origins (domain names) that CloudFront can use as the value for theAccess-Control-Allow-Origin
HTTP response header.static interface
A list of HTTP headers that CloudFront includes as values for theAccess-Control-Expose-Headers
HTTP response header.static final class
A fluent builder forCfnResponseHeadersPolicy
.static interface
The policy directives and their values that CloudFront includes as values for theContent-Security-Policy
HTTP response header.static interface
Determines whether CloudFront includes theX-Content-Type-Options
HTTP response header with its value set tonosniff
.static interface
A configuration for a set of HTTP response headers that are used for cross-origin resource sharing (CORS).static interface
An HTTP response header name and its value.static interface
A list of HTTP response header names and their values.static interface
Determines whether CloudFront includes theX-Frame-Options
HTTP response header and the header's value.static interface
Determines whether CloudFront includes theReferrer-Policy
HTTP response header and the header's value.static interface
The name of an HTTP header that CloudFront removes from HTTP responses to requests that match the cache behavior that this response headers policy is attached to.static interface
A list of HTTP header names that CloudFront removes from HTTP responses to requests that match the cache behavior that this response headers policy is attached to.static interface
A response headers policy configuration.static interface
A configuration for a set of security-related HTTP response headers.static interface
A configuration for enabling theServer-Timing
header in HTTP responses sent from CloudFront.static interface
Determines whether CloudFront includes theStrict-Transport-Security
HTTP response header and the header's value.static interface
Determines whether CloudFront includes theX-XSS-Protection
HTTP response header and the header's value.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ModifierConstructorDescriptionprotected
CfnResponseHeadersPolicy
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnResponseHeadersPolicy
(software.amazon.jsii.JsiiObjectRef objRef) CfnResponseHeadersPolicy
(software.constructs.Construct scope, String id, CfnResponseHeadersPolicyProps props) -
Method Summary
Modifier and TypeMethodDescriptionThe unique identifier for the response headers policy.The date and time when the response headers policy was last modified.A response headers policy configuration.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
A response headers policy configuration.void
A response headers policy configuration.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.constructs.Construct
getNode, isConstruct
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnResponseHeadersPolicy
protected CfnResponseHeadersPolicy(software.amazon.jsii.JsiiObjectRef objRef) -
CfnResponseHeadersPolicy
protected CfnResponseHeadersPolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnResponseHeadersPolicy
@Stability(Stable) public CfnResponseHeadersPolicy(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnResponseHeadersPolicyProps props) - Parameters:
scope
- Scope in which this resource is defined. This parameter is required.id
- Construct identifier for this resource (unique in its scope). This parameter is required.props
- Resource properties. This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderProperties
in classCfnResource
- Parameters:
props
- This parameter is required.
-
getAttrId
The unique identifier for the response headers policy.For example:
57f99797-3b20-4e1b-a728-27972a74082a
. -
getAttrLastModifiedTime
The date and time when the response headers policy was last modified. -
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getResponseHeadersPolicyConfig
A response headers policy configuration. -
setResponseHeadersPolicyConfig
A response headers policy configuration. -
setResponseHeadersPolicyConfig
@Stability(Stable) public void setResponseHeadersPolicyConfig(@NotNull CfnResponseHeadersPolicy.ResponseHeadersPolicyConfigProperty value) A response headers policy configuration.
-