Setting HTTP/3 Alt-Svc header","error":"no port can be announced, specify it explicitly using Server.Port or Server.Addr

1. Output of caddy version:

v2.5.2 h1:eCJdLyEyAGzuQTa5Mh3gETnYWDClo1LjtQm2q9RNZrs=

2. How I run Caddy:

a. System environment:

$ uname -a
Linux azabache 5.15.0-1013-raspi #15-Ubuntu SMP PREEMPT Mon Aug 8 06:33:06 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.1 LTS
Release:	22.04
Codename:	jammy

b. Command:

sudo service caddy start

c. Service/unit/compose file:

[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target

[Service]
Type=notify
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE

[Install]
WantedBy=multi-user.target

d. My complete Caddy config:

{
        email my@email.com
        debug
        servers {
                protocol {
                        experimental_http3
                }
        }
}

azabache.narwhal-nominal.ts.net {
        encode zstd gzip
        rewrite * /admin{uri}
        reverse_proxy localhost:1080
}

3. The problem I’m having:

So I was setting up a log monitoring system for Caddy using Loki and Grafana when I noticed the following error several times on my Caddy logs:

Sep 03 09:50:10 azabache caddy[639966]: {"level":"error","ts":1662198610.6536984,"logger":"http.log","msg":"setting HTTP/3 Alt-Svc header","error":"no port can be announced, specify it explicitly using Server.Port or Server.Addr"}

As far as I can tell, everything is working just fine, so I don’t really get what the this error is about :man_shrugging:. The reverso proxy is serving the requests just fine and I also check from the browser and indeed it’s using http3

4. Error messages and/or full log output:

This are the logs just after reloading with the above config.

Sep 03 09:50:10 azabache systemd[1]: Reloaded Caddy.
Sep 03 09:50:10 azabache caddy[639966]: {"level":"error","ts":1662198610.6536984,"logger":"http.log","msg":"setting HTTP/3 Alt-Svc header","error":"no port can be announced, specify it explicitly using Server.Port or Server.Addr"}
Sep 03 09:50:11 azabache caddy[639966]: {"level":"error","ts":1662198611.692947,"logger":"http.log","msg":"setting HTTP/3 Alt-Svc header","error":"no port can be announced, specify it explicitly using Server.Port or Server.Addr"}
Sep 03 09:50:12 azabache caddy[639966]: {"level":"error","ts":1662198612.9336665,"logger":"http.log","msg":"setting HTTP/3 Alt-Svc header","error":"no port can be announced, specify it explicitly using Server.Port or Server.Addr"}
Sep 03 09:50:13 azabache caddy[639966]: {"level":"error","ts":1662198613.97043,"logger":"http.log","msg":"setting HTTP/3 Alt-Svc header","error":"no port can be announced, specify it explicitly using Server.Port or Server.Addr"}
Sep 03 09:50:14 azabache caddy[639966]: {"level":"debug","ts":1662198614.9356027,"logger":"admin.api","msg":"received request","method":"GET","host":"localhost:2019","uri":"/metrics","remote_ip":"127.0.0.1","remote_port":"45538","headers"
:{"Accept":["application/openmetrics-text; version=0.0.1,text/plain;version=0.0.4;q=0.5,*/*;q=0.1"],"Accept-Encoding":["gzip"],"User-Agent":["Prometheus/2.31.2+ds1"],"X-Prometheus-Scrape-Timeout-Seconds":["10"]}}
Sep 03 09:50:15 azabache caddy[639966]: {"level":"error","ts":1662198615.0004005,"logger":"http.log","msg":"setting HTTP/3 Alt-Svc header","error":"no port can be announced, specify it explicitly using Server.Port or Server.Addr"}
Sep 03 09:50:15 azabache caddy[639966]: {"level":"error","ts":1662198615.3829901,"logger":"http.log","msg":"setting HTTP/3 Alt-Svc header","error":"no port can be announced, specify it explicitly using Server.Port or Server.Addr"}
Sep 03 09:50:16 azabache caddy[639966]: {"level":"error","ts":1662198616.0343983,"logger":"http.log","msg":"setting HTTP/3 Alt-Svc header","error":"no port can be announced, specify it explicitly using Server.Port or Server.Addr"}
Sep 03 09:50:17 azabache caddy[639966]: {"level":"error","ts":1662198617.5593264,"logger":"http.log","msg":"setting HTTP/3 Alt-Svc header","error":"no port can be announced, specify it explicitly using Server.Port or Server.Addr"}
Sep 03 09:50:18 azabache caddy[639966]: {"level":"error","ts":1662198618.5905771,"logger":"http.log","msg":"setting HTTP/3 Alt-Svc header","error":"no port can be announced, specify it explicitly using Server.Port or Server.Addr"}
Sep 03 09:50:19 azabache caddy[639966]: {"level":"error","ts":1662198619.4760358,"logger":"http.log","msg":"setting HTTP/3 Alt-Svc header","error":"no port can be announced, specify it explicitly using Server.Port or Server.Addr"}
Sep 03 09:50:19 azabache caddy[639966]: {"level":"error","ts":1662198619.6231859,"logger":"http.log","msg":"setting HTTP/3 Alt-Svc header","error":"no port can be announced, specify it explicitly using Server.Port or Server.Addr"}
Sep 03 09:50:20 azabache caddy[639966]: {"level":"error","ts":1662198620.6595042,"logger":"http.log","msg":"setting HTTP/3 Alt-Svc header","error":"no port can be announced, specify it explicitly using Server.Port or Server.Addr"}
Sep 03 09:50:21 azabache caddy[639966]: {"level":"error","ts":1662198621.6910257,"logger":"http.log","msg":"setting HTTP/3 Alt-Svc header","error":"no port can be announced, specify it explicitly using Server.Port or Server.Addr"}

5. What I already tried:

I had several domains being served by caddy in my Caddyfile so I’ve been doing several test to isolate what block is causing the issue, so far I think it only happens on Tailscale managed domains.

I was using a version built with several plugins, so I tried also to run standalone Caddy and the error still there.

Of course, if I remove the experimental_http3 option, the error goes away.

6. Links to relevant resources:

The error appears to be coming from here:

1 Like

I had the same log messages when upgrading from 2.5.x to caddy 2.6.1 and enabling http/3 while doing so. After one day involving a server reboot the messages vanished. I seriously have no idea why… maybe some existing “wired” client connections which reconnected tot he new caddy…? :person_shrugging:

1 Like

Does it still happen for you on v2.6.1?

This topic was automatically closed after 30 days. New replies are no longer allowed.