Hi there,
I have migrated my docker-compose stack from nginx to traefik. Unfortunately there is one feature I did not find out how to set it up:
This is my nginx config:
location /maps/upload {
client_max_body_size 64m;
proxy_pass http://api.faforever.com/maps/upload;
}
location /mods/upload {
client_max_body_size 350m;
proxy_pass http://api.faforever.com/mods/upload;
}
Basically, it applies two special settings for 2 unique routes of the whole API. All other routes are restricted to lower file sizes by their default settings.
How can I achieve the same thing in Traefik using docker labels? I have read about maxRequestBodyBytes
but as far as I understand I can setup this only globally for a frontend and since I use Docker I only have one frontend. And it looks like mixing file frontends with docker backends is only possible in Traefik v2.
Hello @Brutus5000,
To enable the max body size configuration, you have to enable the buffering middleware:
https://docs.traefik.io/v1.7/configuration/commons/#buffering
They can be enabled via docker labels:
https://docs.traefik.io/v1.7/configuration/backends/docker/#on-containers
If you want to set different sizes for different paths on docker containers, you need to use segments to define configurations for both:
https://docs.traefik.io/v1.7/configuration/backends/docker/#on-containers-with-multiple-ports-segment-labels
Hi @daniel.tomcej,
I think that is the limitation I have issues with. My application is listening on one port only. If I understand the docs currently (and this matches my tests) I can only apply on segment and only set one single label for maxRequestBodyBytes.
Additional segments are just being ignored.
Hello @Brutus5000,
You can have multiple segments that define the same port
Having multiple segments allows you to use different path/Host matchers on that port.