Class CfnResponseHeadersPolicy
- All Implemented Interfaces:
IEnvironmentAware,IInspectable,IResponseHeadersPolicyRef,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
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
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA list of HTTP header names that CloudFront includes as values for theAccess-Control-Allow-HeadersHTTP response header.static interfaceA list of HTTP methods that CloudFront includes as values for theAccess-Control-Allow-MethodsHTTP response header.static interfaceA list of origins (domain names) that CloudFront can use as the value for theAccess-Control-Allow-OriginHTTP response header.static interfaceA list of HTTP headers that CloudFront includes as values for theAccess-Control-Expose-HeadersHTTP response header.static final classA fluent builder forCfnResponseHeadersPolicy.static interfaceThe policy directives and their values that CloudFront includes as values for theContent-Security-PolicyHTTP response header.static interfaceDetermines whether CloudFront includes theX-Content-Type-OptionsHTTP response header with its value set tonosniff.static interfaceA configuration for a set of HTTP response headers that are used for cross-origin resource sharing (CORS).static interfaceAn HTTP response header name and its value.static interfaceA list of HTTP response header names and their values.static interfaceDetermines whether CloudFront includes theX-Frame-OptionsHTTP response header and the header's value.static interfaceDetermines whether CloudFront includes theReferrer-PolicyHTTP response header and the header's value.static interfaceThe 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 interfaceA 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 interfaceA response headers policy configuration.static interfaceA configuration for a set of security-related HTTP response headers.static interfaceA configuration for enabling theServer-Timingheader in HTTP responses sent from CloudFront.static interfaceDetermines whether CloudFront includes theStrict-Transport-SecurityHTTP response header and the header's value.static interfaceDetermines whether CloudFront includes theX-XSS-ProtectionHTTP response header and the header's value.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.services.cloudfront.IResponseHeadersPolicyRef
IResponseHeadersPolicyRef.Jsii$Default, IResponseHeadersPolicyRef.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnResponseHeadersPolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnResponseHeadersPolicy(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.A reference to a ResponseHeadersPolicy resource.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidA response headers policy configuration.voidA 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, getEnv, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.IEnvironmentAware
getEnvMethods 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:
inspectin 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:
renderPropertiesin 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:
getCfnPropertiesin classCfnResource
-
getResponseHeadersPolicyRef
A reference to a ResponseHeadersPolicy resource.- Specified by:
getResponseHeadersPolicyRefin interfaceIResponseHeadersPolicyRef
-
getResponseHeadersPolicyConfig
A response headers policy configuration.Returns union: either
IResolvableorCfnResponseHeadersPolicy.ResponseHeadersPolicyConfigProperty -
setResponseHeadersPolicyConfig
A response headers policy configuration. -
setResponseHeadersPolicyConfig
@Stability(Stable) public void setResponseHeadersPolicyConfig(@NotNull CfnResponseHeadersPolicy.ResponseHeadersPolicyConfigProperty value) A response headers policy configuration.
-