- Implements: IVerification
Associates an origin with WAFv2 WebACL to verify traffic contains specific header with a secret value.
import { OriginVerify } from '@alma-cdk/origin-verify'
new OriginVerify(scope: Construct, id: string, props: OriginVerifyProps)| Name | Type | Description |
|---|---|---|
scope |
constructs.Construct |
No description. |
id |
string |
No description. |
props |
OriginVerifyProps |
No description. |
- Type: constructs.Construct
- Type: string
- Type: OriginVerifyProps
| Name | Description |
|---|---|
toString |
Returns a string representation of this construct. |
public toString(): stringReturns a string representation of this construct.
| Name | Description |
|---|---|
isConstruct |
Checks if x is a construct. |
import { OriginVerify } from '@alma-cdk/origin-verify'
OriginVerify.isConstruct(x: any)Checks if x is a construct.
Use this method instead of instanceof to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct in each copy of the constructs library
is seen as a different class, and an instance of one class will not test as
instanceof the other class. npm install will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof will behave
unpredictably. It is safest to avoid using instanceof, and using
this type-testing method instead.
- Type: any
Any object.
| Name | Type | Description |
|---|---|---|
node |
constructs.Node |
The tree node. |
headerName |
string |
CloudFront Origin Custom Header name used in the WAFv2 WebACL verification. |
headerValue |
string |
Secret Value used as the CloudFront Origin Custom Header value. |
public readonly node: Node;- Type: constructs.Node
The tree node.
public readonly headerName: string;- Type: string
- Default: 'x-origin-verify'
CloudFront Origin Custom Header name used in the WAFv2 WebACL verification.
public readonly headerValue: string;- Type: string
Secret Value used as the CloudFront Origin Custom Header value.
Example
'xxxxEXAMPLESECRET'| Name | Type | Description |
|---|---|---|
OriginVerifyHeader |
string |
Origin Request Header Default Name. |
public readonly OriginVerifyHeader: string;- Type: string
Origin Request Header Default Name.
Properties for OriginVerify constructor.
import { OriginVerifyProps } from '@alma-cdk/origin-verify'
const originVerifyProps: OriginVerifyProps = { ... }| Name | Type | Description |
|---|---|---|
origin |
aws-cdk-lib.aws_apigateway.IStage | aws-cdk-lib.aws_elasticloadbalancingv2.IApplicationLoadBalancer | aws-cdk-lib.aws_appsync.CfnGraphQLApi |
Origin to protect. |
aclMetricName |
string |
Metric name for the WebACL. |
headerName |
string |
By default x-origin-verify is used. |
ruleMetricName |
string |
Metric name for the allowed requests. |
rules |
aws-cdk-lib.IResolvable | aws-cdk-lib.aws_wafv2.CfnWebACL.RuleProperty[] |
Any additional rules to add into the created WAFv2 WebACL. |
secretValue |
aws-cdk-lib.SecretValue |
The secret which is used to verify the CloudFront distribution. |
public readonly origin: IStage | IApplicationLoadBalancer | CfnGraphQLApi;- Type: aws-cdk-lib.aws_apigateway.IStage | aws-cdk-lib.aws_elasticloadbalancingv2.IApplicationLoadBalancer | aws-cdk-lib.aws_appsync.CfnGraphQLApi
Origin to protect.
Accepted types:
IStage(fromaws-cdk-lib/aws-apigateway)IApplicationLoadBalancer(fromaws-cdk-lib/aws-elasticloadbalancingv2)
public readonly aclMetricName: string;- Type: string
- Default: 'OriginVerifyWebAcl'
Metric name for the WebACL.
public readonly headerName: string;- Type: string
- Default: 'x-origin-verify'
By default x-origin-verify is used.
To override it, provide a value for
this. Recommendation is to use something with a x- prefix.
public readonly ruleMetricName: string;- Type: string
- Default: 'OriginVerifyAllowedRequests'
Metric name for the allowed requests.
public readonly rules: (IResolvable | RuleProperty)[];- Type: aws-cdk-lib.IResolvable | aws-cdk-lib.aws_wafv2.CfnWebACL.RuleProperty[]
Any additional rules to add into the created WAFv2 WebACL.
public readonly secretValue: SecretValue;- Type: aws-cdk-lib.SecretValue
- Default: new Secret().secretValue
The secret which is used to verify the CloudFront distribution.
Optional: By default this construct will generate a new Secret.
- Implemented By: OriginVerify, IVerification
Interface describing the "contract" of return values from the constructor.
| Name | Type | Description |
|---|---|---|
headerName |
string |
CloudFront Origin Custom Header name used in the WAFv2 WebACL verification. |
headerValue |
string |
Secret Value used as the CloudFront Origin Custom Header value. |
public readonly headerName: string;- Type: string
- Default: 'x-origin-verify'
CloudFront Origin Custom Header name used in the WAFv2 WebACL verification.
public readonly headerValue: string;- Type: string
Secret Value used as the CloudFront Origin Custom Header value.
Example
'xxxxEXAMPLESECRET'