You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.21 16:19:53