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
System.Object
OriginRequestHeaderBehavior
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.AWS.CloudFront.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

OriginRequestHeaderBehavior(ByRefValue)

Used by jsii to construct an instance of this class from a Javascript-owned object reference

OriginRequestHeaderBehavior(DeputyBase.DeputyProps)

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.

AllowList(String[])

Listed 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.

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.ByRefValue

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.DeputyBase.DeputyProps

The deputy props

Properties

Behavior

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

public virtual string Behavior { get; }
Property Value

System.String

Headers

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

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

System.String[]

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

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(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

OriginRequestHeaderBehavior

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