最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

aws cdk - API Gateway is censoringmodifying responses from ALB - Stack Overflow

programmeradmin2浏览0评论

How should one use the HttpAlbIntegration for HttpApi on API Gateway v2 library?

At current, my application does indeed build and deploy. However, when I query requests.get(endpoint/ping) the response is 'Healthy Connection'. In truth, I defined a JSON response, where {"status": "ok"} should be returned.

Here's a method FastAPI application hosted on Fargate tasks:

# Health check route
@router.get("/ping", status_code=status.HTTP_200_OK)
async def ping():
    logging.info(f"ping request received.")
    # SageMaker will ping this to check if the endpoint is healthy
    return JSONResponse({"status": "ok"})   

In CDK, I define my integration as

    // Create the HTTP ALB Integration
    const albIntegration = new apigwv2_integrations.HttpAlbIntegration(`AlbIntegration-${props.stageName}`, 
        listener,
        );

    // Create the HTTP API with the integration
    this.httpApi = new apigwv2.HttpApi(this, `HttpApi-${props.stageName}`, {
      defaultIntegration: albIntegration,
    });

My theories are

  1. A VPC Link is needed and the listener object is insufficient.
  2. Some parameters are needed to ensure that API Gateway does not modify responses
  3. Some other explanation

HttpApi HttpAlbIntegration

Can I get clarification and cause/resolution here and proper usage of HttpAlbIntegration?

发布评论

评论列表(0)

  1. 暂无评论