I am running a FastAPI backend service on GKE. There's a legacy endpoint that uses a GET
request with body attached to it. I know that GET
requests are not supposed to have a body, but this is a legacy endpoint used by a library therefore I have no choice but to support it.
Currently when a GET
request with body is send to GKE, I get the following response:
I have tested the endpoint locally and it works without issues. I don't know exactly what the issue is but GCP is definitely intercepting the request at some point and rejecting it due to it having a body.
The only workaround I can think of currently is using a some sort of proxy and converting the request before it reaches GKE. Unfortunately, I'm not a GCP expert.
Has anyone had any experience tackling an issue like this? What would be an optimal solution here, granted that the endpoint has to be supported currently?
EDIT: Added ingress config:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: XXX
namespace: XXX
annotations:
ingress.kubernetes.io/ssl-redirect: "false"
kubernetes.io/ingress.global-static-ip-name: XXX
#ingress.kubernetes.io/enable-cors: "true"
spec:
tls:
- hosts:
- 'XXX'
secretName: tls-secret
rules:
- host: XXX
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: XXX
port:
number: 80
- path: /api
pathType: Prefix
backend:
service:
name: XXX
port:
number: 80
This is a response from the Google Load Balancer, which is configured the the GKE Ingress resource. I don't think that this can be configured in a way that it accepts that request.
You might try using another Ingress controller that doesn't reject such malformed requests.