Responder - a new static response plugin

Hey everyone.

I recently migrated from SWAG to Traefik and found it very easy and intuitive

However - Traefik does not support static responses at all, and the plugins I found were quite cumbersome, as every static response requires a router and middleware and wiring between them.

Solution - another plugin (but a provider rather than a middleware). Responder is a provider plugin that is configured in one place, and

Example - assuming you want to respond to /heartbeat and /robots.txt:

  • with a middleware plugin:
# dynamic conf
http:
    routers:
        ok:
            rule: Path(`/heartbeat`)
            service: noop@internal
            middlewares:
                - response-ok
        robots:
            rule: Path(`/robots.txt`)
            service: noop@internal
            middlewares:
                - response-robots
middlewares:
        response-ok:
            plugin:
                staticresponse:
                    Body: OK
        response-robots:
            plugin:
                staticresponse:
                    Body: "User-agent: *\nDisallow: /"
# static conf
providers:
    plugin:
        responder:
            responses:
                - rule: Path(`/healthcheck`)
                  body: OK
                - rule: Path(`/robots.txt`)
                  body: "User-agent: *\nDisallow: /"

the plugin can be found here
github project here

Hope you find it useful :crossed_fingers: