Skip to content

redirect ​

redirect connects each accepted TCP connection to another address and copies bytes in both directions.

yaml
server:
  entrypoints:
    docker:
      address: ":2375"
  tcp:
    middlewares:
      docker_socket:
        redirect:
          address: /var/run/docker.sock
          network: unix
          disable_nagle: false
          dial_timeout: 10s
          proxy_protocol: false
    routers:
      docker:
        entrypoints:
          - docker
        middlewares:
          - docker_socket
FieldDefaultDescription
addressUpstream address.
networktcpUpstream network: tcp, tcp4, tcp6, unix, unixpacket, udp, udp4, or udp6.
disable_naglefalseDisable Nagle's algorithm for TCP connections.
dial_timeoutnoneTimeout for dialing the upstream.
proxy_protocolfalseSend a PROXY protocol header to TCP upstreams.
proxy_protocol_version1PROXY protocol version: 1 (text) or 2 (binary).
bufferDeprecated and ignored. Data is copied with the kernel splice/sendfile fast path when possible.

redirect is terminal: middlewares after it in the router are not run. When an earlier middleware wraps the connection (for example tls_terminate), the decrypted stream is forwarded. The PROXY header carries the client address seen by the chain, so it is the original client when proxy_protocol is used before it.