diff --git a/packages/prerender-fargate/lib/prerender-fargate.ts b/packages/prerender-fargate/lib/prerender-fargate.ts index 622d35b5..b1d86a92 100644 --- a/packages/prerender-fargate/lib/prerender-fargate.ts +++ b/packages/prerender-fargate/lib/prerender-fargate.ts @@ -94,6 +94,15 @@ export class PrerenderFargate extends Construct { } ); + // As the prerender service will return a 401 on all unauthorised requests + // it should be considered healthy when receiving a 401 response + fargateService.targetGroup.configureHealthCheck({ + path: "/health", + interval: Duration.seconds(120), + unhealthyThresholdCount: 5, + healthyHttpCodes: '401' + }); + // Setup AutoScaling policy const scaling = fargateService.service.autoScaleTaskCount({ maxCapacity: props.maxInstanceCount || 2,