I'm trying to add a HttpRoute in a HttpApi with the following features:
Right now I've the following code:
new HttpRoute(scope, 'Route', {
httpApi,
routeKey: HttpRouteKey.with('/foo'),
integration: new HttpServiceDiscoveryIntegration({
service: service.cloudMapService!,
vpcLink: VpcLink.fromVpcLinkAttributes(scope, 'VpcLink', {
vpc,
vpcLinkId: 'aaa',
}),
}),
});
I can't find the right place to put the wildcard (if I put the wildcard inside the HttpRouteKey.with('/foo*')
it rises an error)
For what concerns the request mapping, I'd like to obtain what follows:
Thanks!!!
Found out CDK doesn't support what I wanted, so I used the Cfn classes:
const integration = new CfnIntegration(scope, 'Integration', {
apiId: httpApi.apiId,
integrationType: HttpIntegrationType.HTTP_PROXY,
integrationUri: service.cloudMapService!.serviceArn,
integrationMethod: HttpMethod.ANY,
connectionId: vpcLink.vpcLinkId,
connectionType: HttpConnectionType.VPC_LINK,
payloadFormatVersion: PayloadFormatVersion.VERSION_1_0.version,
requestParameters: {
'overwrite:path': '$request.path',
},
});
new CfnRoute(scope, 'BeckyRoute', {
apiId: httpApi.apiId,
routeKey: `ANY /foo`,
target: `integrations/${integration.ref}`,
});
new CfnRoute(scope, 'BeckyProxyRoute', {
apiId: httpApi.apiId,
routeKey: `ANY /foo/{proxy+}`,
target: `integrations/${integration.ref}`,
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.