Skip to content

UDP upstreams changes are not detected on config reload #132

@jtackaberry

Description

@jtackaberry

Suppose the following server definition (using a yaml config adapter):

apps:
  layer4:
    servers:
      udp_55353:
        listen:
        - udp/:55353
        routes:
        - handle:
          - handler: proxy
            upstreams:
            - dial:
              - udp/192.168.0.1:53

This works fine. 55353/udp is being forwarded to 192.168.0.1:53 as expected:

2023/07/28 01:27:06.072 DEBUG   layer4.handlers.proxy   dial upstream   {"remote": "127.0.0.1:34036", "upstream": "192.168.0.1:53"}

Now I update the config file and change the single upstream to a different one:

<snip>
            - dial:
              - udp/10.152.128.10:53

And reload the configuration dynamically with caddy reload:

2023/07/28 01:33:59.060 INFO    admin.api       received request        {"method": "POST", "host": "localhost:2019", "uri": "/load", "remote_ip": "127.0.0.1", "remote_port": "55880", "headers": {"Accept-Encoding":["gzip"],"Content-Length":["3539"],"Content-Type":["application/json"],"Origin":["http://localhost:2019"],"User-Agent":["Go-http-client/1.1"]}}
2023/07/28 01:33:59.063 INFO    admin   admin endpoint started  {"address": "localhost:2019", "enforce_origin": false, "origins": ["//localhost:2019", "//[::1]:2019", "//127.0.0.1:2019"]}
2023/07/28 01:33:59.065 DEBUG   layer4  listening       {"address": "udp/[::]:55353"}
2023/07/28 01:33:59.068 INFO    autosaved config (load with --resume flag)      {"file": "/home/tack/.config/caddy/autosave.json"}
2023/07/28 01:33:59.068 INFO    admin.api       load complete
2023/07/28 01:33:59.072 INFO    admin   stopped previous server {"address": "localhost:2019"}

But the updated upstream isn't recognized. New packets continue to go to the old, now-removed endpoint:

2023/07/28 01:36:44.250 DEBUG   layer4.handlers.proxy   dial upstream   {"remote": "127.0.0.1:46652", "upstream": "192.168.0.1:53"}

This is caddy-l4 built on July 21.

$ caddy version
v2.6.4 h1:2hwYqiRwk1tf3VruhMpLcYTg+11fCdr8S3jhNAdnPy8=

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions