Class OriginRequestHeaderBehavior
Determines whether any HTTP headers (and if so, which headers) are included in requests that CloudFront sends to the origin.
Inheritance
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class OriginRequestHeaderBehavior : DeputyBase
Syntax (vb)
Public Class OriginRequestHeaderBehavior
Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
// Creating a custom origin request policy for a Distribution -- all parameters optional
S3Origin bucketOrigin;
var myOriginRequestPolicy = new OriginRequestPolicy(this, "OriginRequestPolicy", new OriginRequestPolicyProps {
OriginRequestPolicyName = "MyPolicy",
Comment = "A default policy",
CookieBehavior = OriginRequestCookieBehavior.None(),
HeaderBehavior = OriginRequestHeaderBehavior.All("CloudFront-Is-Android-Viewer"),
QueryStringBehavior = OriginRequestQueryStringBehavior.AllowList("username")
});
new Distribution(this, "myDistCustomPolicy", new DistributionProps {
DefaultBehavior = new BehaviorOptions {
Origin = bucketOrigin,
OriginRequestPolicy = myOriginRequestPolicy
}
});
Synopsis
Constructors
Origin |
Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Origin |
Used by jsii to construct an instance of this class from DeputyProps |
Properties
Behavior | The behavior of headers: allow all, none or an allow list. |
Headers | The headers for the allow list or the included CloudFront headers, if applicable. |
Methods
All(String[]) | All HTTP headers in viewer requests are included in requests that CloudFront sends to the origin. |
Allow |
Listed headers are included in requests that CloudFront sends to the origin. |
Deny |
All headers except the provided |
None() | HTTP headers are not included in requests that CloudFront sends to the origin. |
Constructors
OriginRequestHeaderBehavior(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected OriginRequestHeaderBehavior(ByRefValue reference)
Parameters
- reference Amazon.
JSII. Runtime. Deputy. By Ref Value The Javascript-owned object reference
OriginRequestHeaderBehavior(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected OriginRequestHeaderBehavior(DeputyBase.DeputyProps props)
Parameters
- props Amazon.
JSII. Runtime. Deputy. Deputy Base. Deputy Props The deputy props
Properties
Behavior
The behavior of headers: allow all, none or an allow list.
public virtual string Behavior { get; }
Property Value
System.
Headers
The headers for the allow list or the included CloudFront headers, if applicable.
public virtual string[] Headers { get; }
Property Value
System.
Methods
All(String[])
All HTTP headers in viewer requests are included in requests that CloudFront sends to the origin.
public static OriginRequestHeaderBehavior All(params string[] cloudfrontHeaders)
Parameters
- cloudfrontHeaders System.
String []
Returns
Remarks
Additionally, any additional CloudFront headers provided are included; the additional headers are added by CloudFront.
See: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-cloudfront-headers.html
AllowList(String[])
Listed headers are included in requests that CloudFront sends to the origin.
public static OriginRequestHeaderBehavior AllowList(params string[] headers)
Parameters
- headers System.
String []
Returns
DenyList(String[])
All headers except the provided headers
are included in requests that CloudFront sends to the origin.
public static OriginRequestHeaderBehavior DenyList(params string[] headers)
Parameters
- headers System.
String []
Returns
None()
HTTP headers are not included in requests that CloudFront sends to the origin.
public static OriginRequestHeaderBehavior None()
Returns
Remarks
Any headers that are listed in a CachePolicy are still included in origin requests.