{"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

# 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":"

\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":"\nK8s ingress-nginx \u540e\u7aef\u670d\u52a1\u83b7\u53d6\u4e0d\u5230\u81ea\u5b9a\u4e49header - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"K8s ingress-nginx \u540e\u7aef\u670d\u52a1\u83b7\u53d6\u4e0d\u5230\u81ea\u5b9a\u4e49header - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\" \/>\n<meta property=\"og:description\" content=\"\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\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/\" \/>\n<meta property=\"og:site_name\" content=\"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-21T03:15:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-04-07T01:55:29+00:00\" \/>\n<meta name=\"author\" content=\"\u7ba1\u7406\u5458\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/\"},\"author\":{\"name\":\"\u7ba1\u7406\u5458\",\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\"},\"headline\":\"K8s ingress-nginx \u540e\u7aef\u670d\u52a1\u83b7\u53d6\u4e0d\u5230\u81ea\u5b9a\u4e49header\",\"datePublished\":\"2022-06-21T03:15:48+00:00\",\"dateModified\":\"2023-04-07T01:55:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/\"},\"wordCount\":21,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\"},\"keywords\":[\"ingress-nginx\",\"k8s\"],\"articleSection\":[\"Kubernetes\"],\"inLanguage\":\"zh-CN\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/\",\"url\":\"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/\",\"name\":\"K8s ingress-nginx \u540e\u7aef\u670d\u52a1\u83b7\u53d6\u4e0d\u5230\u81ea\u5b9a\u4e49header - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\",\"isPartOf\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#website\"},\"datePublished\":\"2022-06-21T03:15:48+00:00\",\"dateModified\":\"2023-04-07T01:55:29+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/#breadcrumb\"},\"inLanguage\":\"zh-CN\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.linuxdevops.cn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"kubernetes\",\"item\":\"https:\/\/www.linuxdevops.cn\/kubernetes\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"K8s ingress-nginx \u540e\u7aef\u670d\u52a1\u83b7\u53d6\u4e0d\u5230\u81ea\u5b9a\u4e49header\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.linuxdevops.cn\/#website\",\"url\":\"https:\/\/www.linuxdevops.cn\/\",\"name\":\"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\",\"description\":\"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\u7b14\u8bb0\",\"publisher\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\"},\"alternateName\":\"linuxdevops\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.linuxdevops.cn\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-CN\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\",\"name\":\"\u7ba1\u7406\u5458\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-CN\",\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg\",\"contentUrl\":\"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg\",\"width\":512,\"height\":512,\"caption\":\"\u7ba1\u7406\u5458\"},\"logo\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/\"},\"description\":\"\u7ba1\u7406\u5458\",\"url\":\"https:\/\/www.linuxdevops.cn\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"K8s ingress-nginx \u540e\u7aef\u670d\u52a1\u83b7\u53d6\u4e0d\u5230\u81ea\u5b9a\u4e49header - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/","og_locale":"zh_CN","og_type":"article","og_title":"K8s ingress-nginx \u540e\u7aef\u670d\u52a1\u83b7\u53d6\u4e0d\u5230\u81ea\u5b9a\u4e49header - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","og_description":"\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","og_url":"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/","og_site_name":"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","article_published_time":"2022-06-21T03:15:48+00:00","article_modified_time":"2023-04-07T01:55:29+00:00","author":"\u7ba1\u7406\u5458","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/#article","isPartOf":{"@id":"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/"},"author":{"name":"\u7ba1\u7406\u5458","@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1"},"headline":"K8s ingress-nginx \u540e\u7aef\u670d\u52a1\u83b7\u53d6\u4e0d\u5230\u81ea\u5b9a\u4e49header","datePublished":"2022-06-21T03:15:48+00:00","dateModified":"2023-04-07T01:55:29+00:00","mainEntityOfPage":{"@id":"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/"},"wordCount":21,"commentCount":0,"publisher":{"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1"},"keywords":["ingress-nginx","k8s"],"articleSection":["Kubernetes"],"inLanguage":"zh-CN","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/","url":"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/","name":"K8s ingress-nginx \u540e\u7aef\u670d\u52a1\u83b7\u53d6\u4e0d\u5230\u81ea\u5b9a\u4e49header - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","isPartOf":{"@id":"https:\/\/www.linuxdevops.cn\/#website"},"datePublished":"2022-06-21T03:15:48+00:00","dateModified":"2023-04-07T01:55:29+00:00","breadcrumb":{"@id":"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/#breadcrumb"},"inLanguage":"zh-CN","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.linuxdevops.cn\/2022\/06\/k8s-ingress-nginx-backend-service-failed-to-get-the-custom\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.linuxdevops.cn\/"},{"@type":"ListItem","position":2,"name":"kubernetes","item":"https:\/\/www.linuxdevops.cn\/kubernetes\/"},{"@type":"ListItem","position":3,"name":"K8s ingress-nginx \u540e\u7aef\u670d\u52a1\u83b7\u53d6\u4e0d\u5230\u81ea\u5b9a\u4e49header"}]},{"@type":"WebSite","@id":"https:\/\/www.linuxdevops.cn\/#website","url":"https:\/\/www.linuxdevops.cn\/","name":"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","description":"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\u7b14\u8bb0","publisher":{"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1"},"alternateName":"linuxdevops","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.linuxdevops.cn\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-CN"},{"@type":["Person","Organization"],"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1","name":"\u7ba1\u7406\u5458","image":{"@type":"ImageObject","inLanguage":"zh-CN","@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/","url":"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg","contentUrl":"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg","width":512,"height":512,"caption":"\u7ba1\u7406\u5458"},"logo":{"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/"},"description":"\u7ba1\u7406\u5458","url":"https:\/\/www.linuxdevops.cn\/author\/root\/"}]}},"_links":{"self":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts\/1145"}],"collection":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/comments?post=1145"}],"version-history":[{"count":1,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts\/1145\/revisions"}],"predecessor-version":[{"id":1147,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts\/1145\/revisions\/1147"}],"wp:attachment":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/media?parent=1145"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/categories?post=1145"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/tags?post=1145"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}