Change what Traefik does
Turn on compression or sticky sessions, or add Traefik middlewares such as a rate limit or an IP allow list to a web application.
Updated
Traefik routes every request to your web applications, and you choose what it does with each one before it reaches your application. Turn on compression or sticky sessions in a click, or paste middlewares straight from the Traefik documentation.
Change what Traefik does
Traefik settings are an experimental feature, so an owner or an admin first turns on Traefik settings under Experimental in your team's settings.
- Open the web application, then its Configuration tab.
- Choose Edit next to Traefik.
- Pick your settings, save, then choose Apply configuration or deploy.
The next deployment brings them in, and the running release keeps its own until then, so a mistake never reaches the release that serves your visitors.
Compression
Traefik compresses each response that the browser accepts compressed, which saves bandwidth on HTML, JSON and scripts. It leaves server-sent events alone, because a stream of events must reach the browser as it comes.
Sticky sessions
A visitor's requests go back to the replica that answered the first one, which helps an application that keeps sessions or WebSocket state in memory. A cookie named tenkai_sticky carries the replica, and a visitor whose replica stopped, after a deployment for instance, moves to another one and gets a new cookie.
Middlewares
Paste the labels of a middleware as the Traefik documentation shows them for Docker, one on each line.
traefik.http.middlewares.limit.ratelimit.average=100
traefik.http.middlewares.limit.ratelimit.burst=50
traefik.http.middlewares.office.ipallowlist.sourcerange=203.0.113.0/24
The word after middlewares. is a name you choose, and the lines that share it build one middleware, so limit above allows 100 requests a second with bursts of 50. Each request goes through Tenkai's protection first, then the compression, then your middlewares in the order their names first appear, and the security headers Tenkai sets win over yours.
Every built-in HTTP middleware works except chain, errors and plugins, and you leave out the label that adds a middleware to a router, such as traefik.http.routers.my-router.middlewares=limit, because Tenkai adds yours to each route of the application.
When Traefik refuses a middleware
Tenkai checks the shape of each line when you save, and Traefik checks the values when it deploys, such as a regular expression or a number. A deployment whose routes Traefik cannot build fails, and your current release keeps serving. Its log names the middleware Traefik refused, so fix the line, save, and deploy again.