Show / Hide Table of Contents

Class OriginRequestHeaderBehavior

Determines whether any HTTP headers (and if so, which headers) are included in requests that CloudFront sends to the origin.

Inheritance
object
OriginRequestHeaderBehavior
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

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(params string[])

All HTTP headers in viewer requests are included in requests that CloudFront sends to the origin.

AllowList(params string[])

Listed headers are included in requests that CloudFront sends to the origin.

DenyList(params string[])

All headers except the provided headers are included in requests that CloudFront sends to the origin.

None()

HTTP headers are not included in requests that CloudFront sends to the origin.

Properties

Behavior

The behavior of headers: allow all, none or an allow list.

public virtual string Behavior { get; }
Property Value

string

Remarks

ExampleMetadata: infused

Headers

The headers for the allow list or the included CloudFront headers, if applicable.

public virtual string[]? Headers { get; }
Property Value

string[]

Remarks

ExampleMetadata: infused

Methods

All(params 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 string[]
Returns

OriginRequestHeaderBehavior

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(params string[])

Listed headers are included in requests that CloudFront sends to the origin.

public static OriginRequestHeaderBehavior AllowList(params string[] headers)
Parameters
headers string[]
Returns

OriginRequestHeaderBehavior

Remarks

ExampleMetadata: infused

DenyList(params 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 string[]
Returns

OriginRequestHeaderBehavior

Remarks

ExampleMetadata: infused

None()

HTTP headers are not included in requests that CloudFront sends to the origin.

public static OriginRequestHeaderBehavior None()
Returns

OriginRequestHeaderBehavior

Remarks

Any headers that are listed in a CachePolicy are still included in origin requests.

Back to top Generated by DocFX