如何通过apigatewayv2-controller配置覆盖HTTP Host请求头?
解决AWS HTTP API网关Host请求头覆盖配置问题
要通过apigatewayv2-controller的Integration配置覆盖Host请求头为my.local.host,requestParameters的正确格式如下:
核心配置片段
requestParameters: integration.request.header.Host: "'my.local.host'"
完整的Integration清单
apiVersion: apigatewayv2.services.k8s.aws/v1alpha1 kind: Integration metadata: name: integration-my namespace: rental-connect spec: apiRef: from: name: adopt-api-gateway-my connectionID: id integrationType: HTTP_PROXY connectionType: VPC_LINK integrationURI: arn:aws:elasticloadbalancing:eu-central-1:... integrationMethod: ANY payloadFormatVersion: "1.0" requestParameters: integration.request.header.Host: "'my.local.host'"
关键说明
- 键名
integration.request.header.Host是AWS HTTP API的标准参数格式,用于指定要修改的集成请求头 - 值部分需要用单引号包裹目标Host值,确保YAML正确解析固定字符串,API网关会将转发到后端的Host头固定设置为
my.local.host
内容的提问来源于stack exchange,提问作者Oleksandr Khomenko
相关产品推荐
相关产品推荐

