0

There's a need to apply a request body size limit to certain domain names via Traefik.

The Traefik middleware is:

apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: request-limits
spec:
  buffering:
    maxRequestBodyBytes: 10485760
    retryExpression: "IsNetworkError() && Attempts() < 2"

And this can be applied globally via:

additionalArguments:
  - --entrypoints.websecure.http.middlewares=traefik-request-limits@kubernetescrd

How can this middleware be applied to certain domain names?

What I've tried - remove the above additionalArguments, and replace it with:

http:
  routers:
    http-specific:
      rule: "HostRegexp(`{name:(.*-)(service|mock|proxy)\\.(.*)\\.(example\\.com}`)"
      entrypoints:
        - websecure
      middlewares:
        - request-limits
      service:
        - noop@internal

However - the above route is not getting created.

Any tips or pointers would be much appreciated.

Traefik Feature Status

  • List item

https://github.com/traefik/traefik/issues/5098

Theo Sweeny
  • 1,033
  • 14
  • 26

0 Answers0