Skip to content

Redirect

redirect proxies datagrams on a UDP entrypoint to an upstream UDP server. For each incoming datagram it dials the target, forwards the payload, waits for one reply within timeout, and writes the reply back to the peer.

This fits single request/response protocols such as DNS. Protocols that answer with multiple datagrams per request are not supported.

yaml
server:
  udp:
    middlewares:
      upstream_dns:
        redirect:
          address: 1.1.1.1:53
          network: udp
          timeout: 5s
          buffer: 65535
    routers:
      dns:
        entrypoints:
          - dns
        middlewares:
          - upstream_dns
FieldDefaultDescription
addressUpstream host:port to forward datagrams to.
networkudpNetwork used to dial the upstream (udp, udp4, udp6).
timeout5sTimeout for dialing the upstream and waiting for the reply.
buffer65535Read buffer size for the upstream reply.

redirect is a terminal middleware: it writes the response and should be the last entry in the router chain.