@Generated(value="jsii-pacmak/1.60.0 (build ebcefe6)", date="2022-06-22T23:27:58.553Z") public class CfnResponseHeadersPolicy extends CfnResource implements IInspectable
A response headers policy.
A response headers policy contains information about a set of HTTP response headers and their values.
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, CloudFront adds the headers in the policy to HTTP responses that it sends for requests that match the cache behavior.
For more information, see Adding HTTP headers to 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()) .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()) .build()) .build();
Modifier and Type | Class and Description |
---|---|
static interface |
CfnResponseHeadersPolicy.AccessControlAllowHeadersProperty
A list of HTTP header names that CloudFront includes as values for the `Access-Control-Allow-Headers` HTTP response header.
|
static interface |
CfnResponseHeadersPolicy.AccessControlAllowMethodsProperty
A list of HTTP methods that CloudFront includes as values for the `Access-Control-Allow-Methods` HTTP response header.
|
static interface |
CfnResponseHeadersPolicy.AccessControlAllowOriginsProperty
A list of origins (domain names) that CloudFront can use as the value for the `Access-Control-Allow-Origin` HTTP response header.
|
static interface |
CfnResponseHeadersPolicy.AccessControlExposeHeadersProperty
A list of HTTP headers that CloudFront includes as values for the `Access-Control-Expose-Headers` HTTP response header.
|
static class |
CfnResponseHeadersPolicy.Builder
A fluent builder for
CfnResponseHeadersPolicy . |
static interface |
CfnResponseHeadersPolicy.ContentSecurityPolicyProperty
The policy directives and their values that CloudFront includes as values for the `Content-Security-Policy` HTTP response header.
|
static interface |
CfnResponseHeadersPolicy.ContentTypeOptionsProperty
Determines whether CloudFront includes the `X-Content-Type-Options` HTTP response header with its value set to `nosniff` .
|
static interface |
CfnResponseHeadersPolicy.CorsConfigProperty
A configuration for a set of HTTP response headers that are used for cross-origin resource sharing (CORS).
|
static interface |
CfnResponseHeadersPolicy.CustomHeaderProperty
An HTTP response header name and its value.
|
static interface |
CfnResponseHeadersPolicy.CustomHeadersConfigProperty
A list of HTTP response header names and their values.
|
static interface |
CfnResponseHeadersPolicy.FrameOptionsProperty
Determines whether CloudFront includes the `X-Frame-Options` HTTP response header and the header’s value.
|
static interface |
CfnResponseHeadersPolicy.ReferrerPolicyProperty
Determines whether CloudFront includes the `Referrer-Policy` HTTP response header and the header’s value.
|
static interface |
CfnResponseHeadersPolicy.ResponseHeadersPolicyConfigProperty
A response headers policy configuration.
|
static interface |
CfnResponseHeadersPolicy.SecurityHeadersConfigProperty
A configuration for a set of security-related HTTP response headers.
|
static interface |
CfnResponseHeadersPolicy.StrictTransportSecurityProperty
Determines whether CloudFront includes the `Strict-Transport-Security` HTTP response header and the header’s value.
|
static interface |
CfnResponseHeadersPolicy.XSSProtectionProperty
Determines whether CloudFront includes the `X-XSS-Protection` HTTP response header and the header’s value.
|
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
IConstruct.Jsii$Default
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
Modifier | Constructor and Description |
---|---|
|
CfnResponseHeadersPolicy(Construct scope,
java.lang.String id,
CfnResponseHeadersPolicyProps props)
Create a new `AWS::CloudFront::ResponseHeadersPolicy`.
|
protected |
CfnResponseHeadersPolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnResponseHeadersPolicy(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAttrId()
The unique identifier for the cache policy.
|
java.lang.String |
getAttrLastModifiedTime()
The date and time when the response headers policy was last modified.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getCfnProperties() |
java.lang.Object |
getResponseHeadersPolicyConfig()
A response headers policy configuration.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
renderProperties(java.util.Map<java.lang.String,java.lang.Object> props) |
void |
setResponseHeadersPolicyConfig(CfnResponseHeadersPolicy.ResponseHeadersPolicyConfigProperty value)
A response headers policy configuration.
|
void |
setResponseHeadersPolicyConfig(IResolvable value)
A response headers policy configuration.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
getRef
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
public static final java.lang.String CFN_RESOURCE_TYPE_NAME
protected CfnResponseHeadersPolicy(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnResponseHeadersPolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public CfnResponseHeadersPolicy(Construct scope, java.lang.String id, CfnResponseHeadersPolicyProps props)
scope
- - scope in which this resource is defined. This parameter is required.id
- - scoped id of the resource. This parameter is required.props
- - resource properties. This parameter is required.public void inspect(TreeInspector inspector)
inspect
in interface IInspectable
inspector
- - tree inspector to collect and process attributes. This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> renderProperties(java.util.Map<java.lang.String,java.lang.Object> props)
renderProperties
in class CfnResource
props
- This parameter is required.public java.lang.String getAttrId()
For example: 57f99797-3b20-4e1b-a728-27972a74082a
.
public java.lang.String getAttrLastModifiedTime()
protected java.util.Map<java.lang.String,java.lang.Object> getCfnProperties()
getCfnProperties
in class CfnResource
public java.lang.Object getResponseHeadersPolicyConfig()
A response headers policy contains information about a set of HTTP response headers and their values. CloudFront adds the headers in the policy to HTTP responses that it sends for requests that match a cache behavior that’s associated with the policy.
public void setResponseHeadersPolicyConfig(IResolvable value)
A response headers policy contains information about a set of HTTP response headers and their values. CloudFront adds the headers in the policy to HTTP responses that it sends for requests that match a cache behavior that’s associated with the policy.
public void setResponseHeadersPolicyConfig(CfnResponseHeadersPolicy.ResponseHeadersPolicyConfigProperty value)
A response headers policy contains information about a set of HTTP response headers and their values. CloudFront adds the headers in the policy to HTTP responses that it sends for requests that match a cache behavior that’s associated with the policy.