Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maxResponseBodyBytes exceed doesn't change response code to 500 #10687

Open
2 tasks done
AliaksandrZhloba opened this issue May 4, 2024 · 3 comments
Open
2 tasks done
Labels
area/server contributor/wanted Participation from an external contributor is highly requested kind/bug/possible a possible bug that needs analysis before it is confirmed or fixed.

Comments

@AliaksandrZhloba
Copy link

AliaksandrZhloba commented May 4, 2024

Welcome!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've searched similar issues on the Traefik community forum and didn't find any.

What did you do?

I setup a response size limit, see https://doc.traefik.io/traefik/middlewares/http/buffering/#maxresponsebodybytes.

What did you see instead?

Trimmed with maxResponseBodyBytes response body and 200 status code.

What version of Traefik are you using?

2.11.2

What is your environment & configuration?

  • traefik.http.routers.backend.middlewares=limit@docker
  • traefik.http.middlewares.limit.buffering.maxResponseBodyBytes=2000000

If applicable, please paste the log output in DEBUG level

No response

@nmengin
Copy link
Contributor

nmengin commented May 6, 2024

Hey @AliaksandrZhloba,

Thanks for reaching out.

Could you provide a minimal reproducible case (for instance, full Kubernetes manifest to reproduce the issue)?

In the meantime, if any community member can help us find verified steps to reproduce and fix the issue if possible, we would love the help.

@nmengin nmengin added kind/bug/possible a possible bug that needs analysis before it is confirmed or fixed. area/server contributor/wanted Participation from an external contributor is highly requested and removed status/0-needs-triage labels May 6, 2024
@AliaksandrZhloba
Copy link
Author

Hello @nmengin ,

docker-compose.yml:

services:
  reverse-proxy:
    image: traefik:v2.11.2
    command: --api.insecure=true --providers.docker --entryPoints.web.address=:80 --entryPoints.websecure.address=:443
    ports:
      - "80:80"
      - "8080:8080"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

  backend:
    image: ealen/echo-server
    labels:
      - traefik.http.routers.backend.rule=Host(`echo.docker.localhost`) || PathPrefix(`/echo`)
      - traefik.http.routers.backend.entrypoints=web
      - traefik.http.services.backend.loadbalancer.server.port=80
      - traefik.http.routers.backend.middlewares=limit@docker
      - traefik.http.middlewares.limit.buffering.maxResponseBodyBytes=20000

POST echo.docker.localhost with any large body.

Tried web and websecure entrypoints - the result is the same.
Tried v2.11.2 and v3.0.0 - similar (although v3.0.0 sometimes writes ERR write: total size of 32768 exceeded allowed 20000 entryPointName=web middlewareName=limit@docker middlewareType=Buffer routerName=backend@docker to log).
When maxResponseBodyBytes=2000 - the response is 500 Internal Server Error
When maxResponseBodyBytes=20000 - the response is 200, by the body is not only trimmed but sometimes contains some trash.

@nmengin
Copy link
Contributor

nmengin commented May 13, 2024

Hey @AliaksandrZhloba,

Thanks for the additional information.
If any community member can help us to move forward on it, we would love the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/server contributor/wanted Participation from an external contributor is highly requested kind/bug/possible a possible bug that needs analysis before it is confirmed or fixed.
Projects
None yet
Development

No branches or pull requests

3 participants