ResponseHeadersPolicyConfigProperty Struct
A response headers policy configuration.
A response headers policy configuration contains metadata about the response headers policy, and configurations for sets of HTTP response headers.
| Source | |
|---|---|
| Type last changed |
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_cloudfront as cloudfront } from 'aws-cdk-lib';
const responseHeadersPolicyConfigProperty: cloudfront.CfnResponseHeadersPolicy.ResponseHeadersPolicyConfigProperty = {
name: 'name',
// the properties below are optional
comment: 'comment',
corsConfig: {
accessControlAllowCredentials: false,
accessControlAllowHeaders: {
items: ['items'],
},
accessControlAllowMethods: {
items: ['items'],
},
accessControlAllowOrigins: {
items: ['items'],
},
originOverride: false,
// the properties below are optional
accessControlExposeHeaders: {
items: ['items'],
},
accessControlMaxAgeSec: 123,
},
customHeadersConfig: {
items: [{
header: 'header',
override: false,
value: 'value',
}],
},
removeHeadersConfig: {
items: [{
header: 'header',
}],
},
securityHeadersConfig: {
contentSecurityPolicy: {
contentSecurityPolicy: 'contentSecurityPolicy',
override: false,
},
contentTypeOptions: {
override: false,
},
frameOptions: {
frameOption: 'frameOption',
override: false,
},
referrerPolicy: {
override: false,
referrerPolicy: 'referrerPolicy',
},
strictTransportSecurity: {
accessControlMaxAgeSec: 123,
override: false,
// the properties below are optional
includeSubdomains: false,
preload: false,
},
xssProtection: {
override: false,
protection: false,
// the properties below are optional
modeBlock: false,
reportUri: 'reportUri',
},
},
serverTimingHeadersConfig: {
enabled: false,
// the properties below are optional
samplingRate: 123,
},
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_cloudfront as cloudfront
response_headers_policy_config_property = cloudfront.CfnResponseHeadersPolicy.ResponseHeadersPolicyConfigProperty(
name="name",
# the properties below are optional
comment="comment",
cors_config=cloudfront.CfnResponseHeadersPolicy.CorsConfigProperty(
access_control_allow_credentials=False,
access_control_allow_headers=cloudfront.CfnResponseHeadersPolicy.AccessControlAllowHeadersProperty(
items=["items"]
),
access_control_allow_methods=cloudfront.CfnResponseHeadersPolicy.AccessControlAllowMethodsProperty(
items=["items"]
),
access_control_allow_origins=cloudfront.CfnResponseHeadersPolicy.AccessControlAllowOriginsProperty(
items=["items"]
),
origin_override=False,
# the properties below are optional
access_control_expose_headers=cloudfront.CfnResponseHeadersPolicy.AccessControlExposeHeadersProperty(
items=["items"]
),
access_control_max_age_sec=123
),
custom_headers_config=cloudfront.CfnResponseHeadersPolicy.CustomHeadersConfigProperty(
items=[cloudfront.CfnResponseHeadersPolicy.CustomHeaderProperty(
header="header",
override=False,
value="value"
)]
),
remove_headers_config=cloudfront.CfnResponseHeadersPolicy.RemoveHeadersConfigProperty(
items=[cloudfront.CfnResponseHeadersPolicy.RemoveHeaderProperty(
header="header"
)]
),
security_headers_config=cloudfront.CfnResponseHeadersPolicy.SecurityHeadersConfigProperty(
content_security_policy=cloudfront.CfnResponseHeadersPolicy.ContentSecurityPolicyProperty(
content_security_policy="contentSecurityPolicy",
override=False
),
content_type_options=cloudfront.CfnResponseHeadersPolicy.ContentTypeOptionsProperty(
override=False
),
frame_options=cloudfront.CfnResponseHeadersPolicy.FrameOptionsProperty(
frame_option="frameOption",
override=False
),
referrer_policy=cloudfront.CfnResponseHeadersPolicy.ReferrerPolicyProperty(
override=False,
referrer_policy="referrerPolicy"
),
strict_transport_security=cloudfront.CfnResponseHeadersPolicy.StrictTransportSecurityProperty(
access_control_max_age_sec=123,
override=False,
# the properties below are optional
include_subdomains=False,
preload=False
),
xss_protection=cloudfront.CfnResponseHeadersPolicy.XSSProtectionProperty(
override=False,
protection=False,
# the properties below are optional
mode_block=False,
report_uri="reportUri"
)
),
server_timing_headers_config=cloudfront.CfnResponseHeadersPolicy.ServerTimingHeadersConfigProperty(
enabled=False,
# the properties below are optional
sampling_rate=123
)
)
java
// 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.*;
ResponseHeadersPolicyConfigProperty responseHeadersPolicyConfigProperty = 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();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.CloudFront;
var responseHeadersPolicyConfigProperty = new ResponseHeadersPolicyConfigProperty {
Name = "name",
// the properties below are optional
Comment = "comment",
CorsConfig = new CorsConfigProperty {
AccessControlAllowCredentials = false,
AccessControlAllowHeaders = new AccessControlAllowHeadersProperty {
Items = new [] { "items" }
},
AccessControlAllowMethods = new AccessControlAllowMethodsProperty {
Items = new [] { "items" }
},
AccessControlAllowOrigins = new AccessControlAllowOriginsProperty {
Items = new [] { "items" }
},
OriginOverride = false,
// the properties below are optional
AccessControlExposeHeaders = new AccessControlExposeHeadersProperty {
Items = new [] { "items" }
},
AccessControlMaxAgeSec = 123
},
CustomHeadersConfig = new CustomHeadersConfigProperty {
Items = new [] { new CustomHeaderProperty {
Header = "header",
Override = false,
Value = "value"
} }
},
RemoveHeadersConfig = new RemoveHeadersConfigProperty {
Items = new [] { new RemoveHeaderProperty {
Header = "header"
} }
},
SecurityHeadersConfig = new SecurityHeadersConfigProperty {
ContentSecurityPolicy = new ContentSecurityPolicyProperty {
ContentSecurityPolicy = "contentSecurityPolicy",
Override = false
},
ContentTypeOptions = new ContentTypeOptionsProperty {
Override = false
},
FrameOptions = new FrameOptionsProperty {
FrameOption = "frameOption",
Override = false
},
ReferrerPolicy = new ReferrerPolicyProperty {
Override = false,
ReferrerPolicy = "referrerPolicy"
},
StrictTransportSecurity = new StrictTransportSecurityProperty {
AccessControlMaxAgeSec = 123,
Override = false,
// the properties below are optional
IncludeSubdomains = false,
Preload = false
},
XssProtection = new XSSProtectionProperty {
Override = false,
Protection = false,
// the properties below are optional
ModeBlock = false,
ReportUri = "reportUri"
}
},
ServerTimingHeadersConfig = new ServerTimingHeadersConfigProperty {
Enabled = false,
// the properties below are optional
SamplingRate = 123
}
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
responseHeadersPolicyConfigProperty := &ResponseHeadersPolicyConfigProperty{
Name: jsii.String("name"),
// the properties below are optional
Comment: jsii.String("comment"),
CorsConfig: &CorsConfigProperty{
AccessControlAllowCredentials: jsii.Boolean(false),
AccessControlAllowHeaders: &AccessControlAllowHeadersProperty{
Items: []*string{
jsii.String("items"),
},
},
AccessControlAllowMethods: &AccessControlAllowMethodsProperty{
Items: []*string{
jsii.String("items"),
},
},
AccessControlAllowOrigins: &AccessControlAllowOriginsProperty{
Items: []*string{
jsii.String("items"),
},
},
OriginOverride: jsii.Boolean(false),
// the properties below are optional
AccessControlExposeHeaders: &AccessControlExposeHeadersProperty{
Items: []*string{
jsii.String("items"),
},
},
AccessControlMaxAgeSec: jsii.Number(123),
},
CustomHeadersConfig: &CustomHeadersConfigProperty{
Items: []interface{}{
&CustomHeaderProperty{
Header: jsii.String("header"),
Override: jsii.Boolean(false),
Value: jsii.String("value"),
},
},
},
RemoveHeadersConfig: &RemoveHeadersConfigProperty{
Items: []interface{}{
&RemoveHeaderProperty{
Header: jsii.String("header"),
},
},
},
SecurityHeadersConfig: &SecurityHeadersConfigProperty{
ContentSecurityPolicy: &ContentSecurityPolicyProperty{
ContentSecurityPolicy: jsii.String("contentSecurityPolicy"),
Override: jsii.Boolean(false),
},
ContentTypeOptions: &ContentTypeOptionsProperty{
Override: jsii.Boolean(false),
},
FrameOptions: &FrameOptionsProperty{
FrameOption: jsii.String("frameOption"),
Override: jsii.Boolean(false),
},
ReferrerPolicy: &ReferrerPolicyProperty{
Override: jsii.Boolean(false),
ReferrerPolicy: jsii.String("referrerPolicy"),
},
StrictTransportSecurity: &StrictTransportSecurityProperty{
AccessControlMaxAgeSec: jsii.Number(123),
Override: jsii.Boolean(false),
// the properties below are optional
IncludeSubdomains: jsii.Boolean(false),
Preload: jsii.Boolean(false),
},
XssProtection: &XSSProtectionProperty{
Override: jsii.Boolean(false),
Protection: jsii.Boolean(false),
// the properties below are optional
ModeBlock: jsii.Boolean(false),
ReportUri: jsii.String("reportUri"),
},
},
ServerTimingHeadersConfig: &ServerTimingHeadersConfigProperty{
Enabled: jsii.Boolean(false),
// the properties below are optional
SamplingRate: jsii.Number(123),
},
}
Properties
commentoptionalstringcommentoptionalstrcommentoptionalStringCommentoptionalstringCommentoptional*string #A comment to describe the response headers policy.
The comment cannot be longer than 128 characters.
corsConfigoptionalIResolvable | CfnResponseHeadersPolicy.cors_configoptionaltyping.Union[IResolvable, CorsConfigProperty]corsConfigoptionalIResolvableCorsConfigoptionalIResolvableCorsConfigoptionalinterface{} #A configuration for a set of HTTP response headers that are used for cross-origin resource sharing (CORS).
customHeadersConfigoptionalIResolvable | CfnResponseHeadersPolicy.custom_headers_configoptionaltyping.Union[IResolvable, CustomHeadersConfigProperty]customHeadersConfigoptionalIResolvableCustomHeadersConfigoptionalIResolvableCustomHeadersConfigoptionalinterface{} #A configuration for a set of custom HTTP response headers.
A name to identify the response headers policy.
The name must be unique for response headers policies in this AWS account .
removeHeadersConfigoptionalIResolvable | CfnResponseHeadersPolicy.remove_headers_configoptionaltyping.Union[IResolvable, RemoveHeadersConfigProperty]removeHeadersConfigoptionalIResolvableRemoveHeadersConfigoptionalIResolvableRemoveHeadersConfigoptionalinterface{} #A configuration for a set of HTTP headers to remove from the HTTP response.
securityHeadersConfigoptionalIResolvable | CfnResponseHeadersPolicy.security_headers_configoptionaltyping.Union[IResolvable, SecurityHeadersConfigProperty]securityHeadersConfigoptionalIResolvableSecurityHeadersConfigoptionalIResolvableSecurityHeadersConfigoptionalinterface{} #A configuration for a set of security-related HTTP response headers.
serverTimingHeadersConfigoptionalIResolvable | CfnResponseHeadersPolicy.server_timing_headers_configoptionaltyping.Union[IResolvable, ServerTimingHeadersConfigProperty]serverTimingHeadersConfigoptionalIResolvableServerTimingHeadersConfigoptionalIResolvableServerTimingHeadersConfigoptionalinterface{} #A configuration for enabling the `Server-Timing` header in HTTP responses sent from CloudFront.