-
I am trying to forward a GraphQL request through APISIX to my upstream server. The route works but when I POST a GraphQl request from Postman or curl, it seems that the request body is removed by APISIX and the upstream server replies This is my route config: Any ideas anybody? Thanks a lot! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @chrisramm! I'm Dosu and I’m helping the apisix team. APISIX should forward GraphQL POST request bodies correctly when using the proxy-rewrite plugin, as it does not remove or modify the request body or Content-Length header by default. Issues like the one you’re seeing are often caused by other plugins (such as kafka-logger with Try disabling all plugins except proxy-rewrite on this route and test again. If the request body is preserved, re-enable plugins one by one to identify the culprit. Also, make sure the Content-Length header is present and correct in the incoming request and not being altered by APISIX or any plugin. If you’re using HTTP/2 or HTTP/3, missing Content-Length will cause the body to be treated as empty, which matches the error you see upstream. If you need to log request bodies, configure logging plugins carefully to avoid interfering with proxying. For GraphQL APIs, using the degraphql plugin alongside proxy-rewrite is a recommended pattern for advanced scenarios, but not required for simple proxying. References:
To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Hi @Baoyuantop thanks for coming back to me. I was able to solve the issue. It was cause by the NGINX forcing HTTP > HTTPS. This redirect caused the loss of some headers including content-length which, in return, caused the unexpected EOF further down the road.