gpt4 book ai didi

Nginx Ingress Controller 抛出 400 Bad Request 错误

转载 作者:行者123 更新时间:2023-12-05 05:03:17 26 4
gpt4 key购买 nike

我已经根据文档 ( Installation guide ) 设置了 Nginx-Ingress Controller ,并使用提供的示例按照步骤操作。当我尝试使用 curl 命令访问该服务时,我收到了一个 400 错误请求。当我查看 nginx-ingress pod 的日志时,我没有看到任何错误。我已附上日志以供引用。我发现很难解决这个问题。在哪里

fetch the pods from the nginx-ingress namespace
$ kubectl get po -n nginx-ingress
NAME READY STATUS RESTARTS AGE
coffee-7c45f487fd-965dq 1/1 Running 0 46m
coffee-7c45f487fd-bncz5 1/1 Running 0 46m
nginx-ingress-7f4b784f79-7k4q6 1/1 Running 0 48m
tea-7769bdf646-g559m 1/1 Running 0 46m
tea-7769bdf646-hlr5j 1/1 Running 0 46m
tea-7769bdf646-p5hp8 1/1 Running 0 46m

making the request. I have set up the DNS record in the /etc/hosts file
$ curl -vv http://cafe.example.com/coffee
GET /coffee HTTP/1.1
> Host: cafe.example.com
> User-Agent: curl/7.61.1
> Accept: */*
>
< HTTP/1.1 400 Bad Request
< Server: nginx/1.17.10
< Date: Mon, 11 May 2020 17:36:31 GMT
< Content-Type: text/html
< Content-Length: 158
< Connection: close

checking the logs after the curl request
$ kubectl logs -n nginx-ingress nginx-ingress-7f 4b784f79-7k4q6

100.96.1.1 - - [11/May/2020:17:31:48 +0000] "PROXY TCP4 172.20.61.112 172.20.61.112 8340 32579" 400 158 "-" "-" "-"
100.96.1.1 - - [11/May/2020:17:31:51 +0000] "PROXY TCP4 172.20.81.142 172.20.81.142 40392 32579" 400 158 "-" "-" "-"
100.96.1.1 - - [11/May/2020:17:31:58 +0000] "PROXY TCP4 172.20.61.112 172.20.61.112 8348 32579" 400 158 "-" "-" "-"
100.96.1.1 - - [11/May/2020:17:32:01 +0000] "PROXY TCP4 172.20.81.142 172.20.81.142 40408 32579" 400 158 "-" "-" "-"
100.96.1.1 - - [11/May/2020:17:32:08 +0000] "PROXY TCP4 172.20.61.112 172.20.61.112 8360 32579" 400 158 "-" "-" "-"
100.96.1.1 - - [11/May/2020:17:32:11 +0000] "PROXY TCP4 172.20.81.142 172.20.81.142 40414 32579" 400 158 "-" "-" "-"
100.96.1.1 - - [11/May/2020:17:32:18 +0000] "PROXY TCP4 3.6.94.242 172.20.81.142 35790 80" 400 158 "-" "-" "-"
100.96.1.1 - - [11/May/2020:17:32:18 +0000] "PROXY TCP4 172.20.61.112 172.20.61.112 8366 32579" 400 158 "-" "-" "-"
100.96.1.1 - - [11/May/2020:17:32:21 +0000] "PROXY TCP4 172.20.81.142 172.20.81.142 40422 32579" 400 158 "-" "-" "-"

最佳答案

添加以下注释后,我能够解决问题。

nginx.ingress.kubernetes.io/backend-protocol: HTTPS
nginx.ingress.kubernetes.io/ssl-redirect: true
nginx.ingress.kubernetes.io/force-ssl-redirect: true

关于Nginx Ingress Controller 抛出 400 Bad Request 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61735888/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com