当我尝试在 GCE 入口上为 GKE 设置请求标头时出现问题

问题描述 投票:0回答:1

大家好,希望你们能帮助我!

我正在尝试创建后端配置并使用以下配置来启用 HSTS

apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
  creationTimestamp: "2023-03-10T14:42:35Z"
  generation: 1
  labels:
    app.kubernetes.io/instance: xxxx
  name: xxxx
  namespace: xxxxxx
spec:
  healthCheck:
    checkIntervalSec: 10
    healthyThreshold: 1
    port: 5000
    requestPath: /health
    timeoutSec: 5
    type: HTTP
    unhealthyThreshold: 5
  customRequestHeaders:
   headers:
   - "X-Client-Region:{client_region}"
   - "X-Client-City:{client_city}"
   - "X-Client-CityLatLong:{client_city_lat_long}"
 customResponseHeaders:
   headers:
   - "hsts:True"
   - "hsts-include-subdomains: True"
   - "hsts-max-age: 28800"

但我收到以下错误

com.google.cloud.v1.BackendConfig.spec 中的未知字段“customResponseHeaders”

信息

api版本:cloud.google.com/v1

文档:https://cloud.google.com/kubernetes-engine/docs/how-to/ingress-configuration#request_headers

我希望解决这个问题并能够在我的后端配置上使用 HSTS。

google-cloud-platform backend google-kubernetes-engine google-compute-engine kubernetes-ingress
1个回答
0
投票

您的 YAML 文件语法不正确,第 24 行缺少空格,如下所示,请自行尝试 https://www.yamllint.com/

© www.soinside.com 2019 - 2024. All rights reserved.