Class OriginRequestHeaderBehavior
Determines whether any HTTP headers (and if so, which headers) are included in requests that CloudFront sends to the origin.
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class OriginRequestHeaderBehavior : DeputyBaseSyntax (vb)
Public Class OriginRequestHeaderBehavior Inherits DeputyBaseRemarks
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  | 
| 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
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
Remarks
Additionally, any additional CloudFront headers provided are included; the additional headers are added by CloudFront.
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
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
Remarks
ExampleMetadata: infused
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.