diff --git a/packages/@aws-cdk/aws-apigatewayv2/lib/http/api-mapping.ts b/packages/@aws-cdk/aws-apigatewayv2/lib/http/api-mapping.ts index 550418e71bfa2..855c6a1f30638 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/lib/http/api-mapping.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/lib/http/api-mapping.ts @@ -68,8 +68,7 @@ export class HttpApiMapping extends Resource implements IApiMapping { apiId: props.api.httpApiId, domainName: props.domainName.domainName, stage: props.stage?.stageName ?? '$default', - // if apiMappingKey is '/' we set it as undefined which maps to the root path of the domain - apiMappingKey: props.apiMappingKey === '/' ? undefined : props.apiMappingKey, + apiMappingKey: props.apiMappingKey, }; const resource = new CfnApiMapping(this, 'Resource', apiMappingProps); diff --git a/packages/@aws-cdk/aws-apigatewayv2/test/http/integrations/integ.custom-domain.expected.json b/packages/@aws-cdk/aws-apigatewayv2/test/http/integ.custom-domain.expected.json similarity index 99% rename from packages/@aws-cdk/aws-apigatewayv2/test/http/integrations/integ.custom-domain.expected.json rename to packages/@aws-cdk/aws-apigatewayv2/test/http/integ.custom-domain.expected.json index 65aace098df5e..2fb796e79265c 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/test/http/integrations/integ.custom-domain.expected.json +++ b/packages/@aws-cdk/aws-apigatewayv2/test/http/integ.custom-domain.expected.json @@ -189,6 +189,7 @@ "ApiId": { "Ref": "HttpProxyProdApi368B6161" }, + "ApiMappingKey": "/", "DomainName": "apigv2.demo.com", "Stage": "$default" } diff --git a/packages/@aws-cdk/aws-apigatewayv2/test/http/integrations/integ.custom-domain.ts b/packages/@aws-cdk/aws-apigatewayv2/test/http/integ.custom-domain.ts similarity index 99% rename from packages/@aws-cdk/aws-apigatewayv2/test/http/integrations/integ.custom-domain.ts rename to packages/@aws-cdk/aws-apigatewayv2/test/http/integ.custom-domain.ts index b371874088941..4064a256d961f 100644 --- a/packages/@aws-cdk/aws-apigatewayv2/test/http/integrations/integ.custom-domain.ts +++ b/packages/@aws-cdk/aws-apigatewayv2/test/http/integ.custom-domain.ts @@ -1,7 +1,7 @@ import * as acm from '@aws-cdk/aws-certificatemanager'; import * as lambda from '@aws-cdk/aws-lambda'; import { App, CfnOutput, Stack } from '@aws-cdk/core'; -import { DomainName, HttpApi, LambdaProxyIntegration } from '../../../lib'; +import { DomainName, HttpApi, LambdaProxyIntegration } from '../../lib'; const app = new App();