Replies: 1 comment 1 reply
-
This is more of a question for the ingress-nginx project, not RKE2. I would probably check out the docs for ingress-nginx, traefik, kong, istio, and so on. However, I suspect that none of them will do what you're asking for because as you noted, the behavior you want violates HTTP RFCs. You might be stuck using bare tcp load-balancers instead of HTTP-aware ingress controllers. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I recently switched my server to kubernetes(v1.21.11+rke2r1) from OKD(Red Hat OpenShift).
But I have some problems.
In RKE2 nginx-ingress is deployed by default at ports 80 and 443,
and I have to receive HTTP request somewhat like below.
POST /hello/world/guys/ HTTP/1.1
HOST: 201.153.126.132:80
content-type: application/json
host: demo.example.com
content-length: 397
But that request will response 400 Bad Request from nginx controller.
Because rfc2616 says that "A 400 Bad Request status code may be sent to any HTTP/1.1 request message that lacks or contains more than one Host header field".
And "HTTP header field names are case-insensitive".
Before switched to kubernetes, OKD has received those requests.
But I don't know how OKD did that.
Now my kubernetes is sending 400 Bad Request.
My ingress is like this.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-ingress
namespace: myNamespace
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /hello/world/$2
spec:
rules:
paths:
pathType: Prefix
backend:
service:
name: myService
port:
number: 8080
My nginx-ingress controller and ingress are working well.
Because I tested request with only one host like below.
POST /hello/world/guys/ HTTP/1.1
HOST: 201.153.126.132:80
content-type: application/json
content-length: 397
OR
POST /hello/world/guys/ HTTP/1.1
content-type: application/json
host: demo.example.com
content-length: 397
Both requests are working well.
I know that handle HTTP header with multiple host field is ridiculous, but I have to deal with this situation.
Is there any way that I can receive that request?
Sorry for asking such a silly question.
Beta Was this translation helpful? Give feedback.
All reactions