Does Buffering Middleware (maxRequestBodyBytes) cause HTTP 500 for backend 302 redirects without trailing slash?

Hi Team,

We recently migrated from NGINX Ingress to Traefik v3 and we observed an issue only for applications routed to a specific backend service (smc-ent).

Expected Behaviour

Accessing https://host/siebel/smc should return 302 Location: /siebel/smc/ and then load successfully.

Actual Behaviour

With the Buffering middleware enabled:

apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
  name: buffering
spec:
  buffering:
    maxRequestBodyBytes: 104857600

the request returns: HTTP/2 500 Internal Server Error instead of the redirect.

The same URL works when a trailing slash is added:

https://host/siebel/smc/

Backend Verification

Directly on the backend pod:

curl http://localhost:4431/siebel/smc --> HTTP/1.1 302

curl http://localhost:4431/siebel/smc/ --> HTTP/1.1 200

Observation

This issue occurs only for routes backed by smc-ent:

  • /siebel/smc
  • /siebel/sma
  • /siebel/migration
  • /siebel/v1.0

Other applications behind the same Traefik instance continue to work normally with the same middleware enabled.

Resolution

After removing:

buffering:
  maxRequestBodyBytes: 104857600

the issue is resolved and Traefik correctly forwards the backend redirect (302).

Questions

  1. Why does the Buffering middleware cause a backend 302 redirect response to be returned as HTTP 500?

  2. Is this behaviour specific to the websecure entrypoint, or would it also occur on the web entrypoint?

  3. We added maxRequestBodyBytes: 104857600 while migrating from NGINX because our NGINX configuration supported uploads up to 100 MB.

    If we remove this middleware:

    • Are there any drawbacks to removing it?
    • What is the recommended way to support 100 MB uploads without causing this issue?

Has anyone seen similar behaviour with backend redirects and the Buffering middleware?

For 100 MB uploads you most likely don't need the Buffering middleware at all. Unlike NGINX (client_max_body_size defaults to 1m), Traefik has no request body size limit by default and streams the body straight to the backend, which is also easier on memory with large uploads.

Buffering holds the whole response as well as the request, so that's where the backend's 302 gets handled differently. To see the actual reason, set the log level to DEBUG and repeat the request; the error from the buffering handler should be logged next to the 500. It's also worth looking at the raw redirect from the pod with curl -sv http://localhost:4431/siebel/smc -o /dev/null and checking whether Content-Length matches the body actually sent. A malformed redirect body would explain why only smc-ent is affected.

It isn't entrypoint-specific; the middleware behaves the same on web and websecure.

If you remove it, the one thing to watch for slow clients is the entrypoint read timeout, which defaults to 60s in v3:

--entryPoints.websecure.transport.respondingTimeouts.readTimeout=600s

(with the Helm chart, put that under additionalArguments).

For 100 MB uploads you most likely don't need the Buffering middleware at all. Unlike NGINX (client_max_body_size defaults to 1m), Traefik has no request body size limit by default and streams the body straight to the backend, which is also easier on memory with large uploads.

Buffering holds the whole response as well as the request, so that's where the backend's 302 gets handled differently. To see the actual reason, set the log level to DEBUG and repeat the request; the error from the buffering handler should be logged next to the 500. It's also worth looking at the raw redirect from the pod with curl -sv http://localhost:4431/siebel/smc -o /dev/null and checking whether Content-Length matches the body actually sent. A malformed redirect body would explain why only smc-ent is affected.

It isn't entrypoint-specific; the middleware behaves the same on web and websecure.

If you remove it, the one thing to watch for slow clients is the entrypoint read timeout, which defaults to 60s in v3:

--entryPoints.websecure.transport.respondingTimeouts.readTimeout=600s

(with the Helm chart, put that under additionalArguments).

Thanks for the suggestion @VPSPioneer. I tested the backend directly from the SMC pod, bypassing Traefik:

curl -sv http://localhost:4431/siebel/smc

The backend returns:

HTTP/1.1 302
Location: /siebel/smc/
Transfer-Encoding: chunked

During the same request through Traefik with the Buffering middleware enabled, DEBUG logging shows:

vulcand/oxy/buffer: failed to read response, err: no data ready
middlewareType=Buffer

and Traefik returns HTTP 500.

I also compared it with another Siebel endpoint that works with the same Buffering middleware. That backend returns HTTP 200 with a normal body and Content-Length, rather than the empty chunked redirect.

This appears very similar to Traefik issue #11568

Is the recommended workaround currently to avoid Buffering for this route, or is there a supported Traefik-side way to handle an empty chunked 302 response without changing the backend?