Class OriginRequestCookieBehavior
Determines whether any cookies in viewer requests (and if so, which cookies) 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 OriginRequestCookieBehavior : DeputyBase
Syntax (vb)
Public Class OriginRequestCookieBehavior
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
OriginRequestCookieBehavior(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
OriginRequestCookieBehavior(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
Behavior | The behavior of cookies: allow all, none or an allow list. |
Cookies | The cookies to allow, if the behavior is an allow list. |
Methods
All() | All cookies in viewer requests are included in requests that CloudFront sends to the origin. |
AllowList(String[]) | Only the provided |
DenyList(String[]) | All cookies except the provided |
None() | Cookies in viewer requests are not included in requests that CloudFront sends to the origin. |
Constructors
OriginRequestCookieBehavior(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected OriginRequestCookieBehavior(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
OriginRequestCookieBehavior(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected OriginRequestCookieBehavior(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
Behavior
The behavior of cookies: allow all, none or an allow list.
public virtual string Behavior { get; }
Property Value
System.String
Cookies
The cookies to allow, if the behavior is an allow list.
public virtual string[] Cookies { get; }
Property Value
System.String[]
Methods
All()
All cookies in viewer requests are included in requests that CloudFront sends to the origin.
public static OriginRequestCookieBehavior All()
Returns
AllowList(String[])
Only the provided cookies
are included in requests that CloudFront sends to the origin.
public static OriginRequestCookieBehavior AllowList(params string[] cookies)
Parameters
- cookies System.String[]
Returns
DenyList(String[])
All cookies except the provided cookies
are included in requests that CloudFront sends to the origin.
public static OriginRequestCookieBehavior DenyList(params string[] cookies)
Parameters
- cookies System.String[]
Returns
None()
Cookies in viewer requests are not included in requests that CloudFront sends to the origin.
public static OriginRequestCookieBehavior None()
Returns
Remarks
Any cookies that are listed in a CachePolicy are still included in origin requests.