{"id":1145,"date":"2022-06-21T11:15:48","date_gmt":"2022-06-21T03:15:48","guid":{"rendered":"https:\/\/www.linuxdevops.cn\/?p=1145"},"modified":"2023-04-07T09:55:29","modified_gmt":"2023-04-07T01:55:29","slug":"k8s-ingress-nginx-backend-service-failed-to-get-the-custom","status":"publish","type":"post","link":"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/","title":{"rendered":"K8s ingress-nginx \u540e\u7aef\u670d\u52a1\u83b7\u53d6\u4e0d\u5230\u81ea\u5b9a\u4e49header"},"content":{"rendered":"
\u539f\u56e0\uff1a<\/p>\n
\u8bf7\u6c42\u7684\u8bf7\u6c42\u5934\u53c2\u6570\u6709\u4e0b\u5212\u7ebf\uff0c\u800cNginx\u4ee3\u7406\u9ed8\u8ba4\u4f1a\u628aheader\u4e2d\u53c2\u6570\u6709\u201c_\u201d\u4e0b\u5212\u7ebf\u7684\u53c2\u6570\u53bb\u6389\uff1b\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u53ea\u9700\u8981\u5728Nginx\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u6dfb\u52a0\uff1aunderscores_in_headers on<\/strong>\uff1b \u9ed8\u8ba4\u4e3a off<\/strong><\/p>\n k8s\u90e8\u7f72\u7684 ingress-nginx \u53ea\u9700\u8981\u5728ingress-nginx-controller Configmap\u4e2d\u6dfb\u52a0 enable-underscores-in-headers: "true"<\/strong> <\/p>\n \u539f\u56e0\uff1a \u8bf7\u6c42\u7684\u8bf7\u6c42\u5934\u53c2\u6570\u6709\u4e0b\u5212\u7ebf\uff0c\u800cNginx\u4ee3\u7406\u9ed8\u8ba4\u4f1a\u628aheader\u4e2d\u53c2\u6570\u6709\u201c_\u201d\u4e0b\u5212\u7ebf\u7684\u53c2\u6570\u53bb\u6389\uff1b\u89e3\u51b3\u8fd9\u4e2a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[111,37],"yoast_head":"\n# Please edit the object below. Lines beginning with a '#' will be ignored,\n# and an empty file will abort the edit. If an error occurs while saving this file will be\n# reopened with the relevant failures.\n#\napiVersion: v1\ndata:\n access-log-path: \/var\/log\/nginx\/access.log\n allow-snippet-annotations: "true"\n compute-full-forwarded-for: "true"\n enable-underscores-in-headers: "true"\n error-log-path: \/var\/log\/nginx\/error.log\n keep-alive-requests: "10000"\n log-format-upstream: $remote_addr - $remote_user [$time_iso8601] $msec "$request"\n $status $body_bytes_sent "$http_referer" "$http_user_agent" $request_length $request_time\n [$proxy_upstream_name] [$proxy_alternative_upstream_name] [$upstream_addr] [$upstream_response_length]\n [$upstream_response_time] [$upstream_status] $req_id\n max-worker-connections: "65536"\nkind: ConfigMap\nmetadata:\n annotations:\n kubectl.kubernetes.io\/last-applied-configuration: |\n {"apiVersion":"v1","data":null,"kind":"ConfigMap","metadata":{"annotations":{},"labels":{"app.kubernetes.io\/component":"controller","app.kubernetes.io\/instance":"ingress-nginx","app.kubernetes.io\/name":"ingress-nginx","app.kubernetes.io\/version":"1.2.0"},"name":"ingress-nginx-controller","namespace":"ingress-nginx"}}\n creationTimestamp: "2022-06-11T06:44:16Z"\n labels:\n app.kubernetes.io\/component: controller\n app.kubernetes.io\/instance: ingress-nginx\n app.kubernetes.io\/name: ingress-nginx\n app.kubernetes.io\/version: 1.2.0\n name: ingress-nginx-controller\n namespace: ingress-nginx\n resourceVersion: "1296033"\n uid: eea7812a-2738-4e7d-b4f3-11041bec5dba\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"