Skip to content

Add echo mode; include Host in /_headers - #5

Merged
byjg merged 2 commits into
masterfrom
feat/echo-mode
Oct 22, 2026
Merged

byjg merged 2 commits into
masterfrom
feat/echo-mode

Conversation

@byjg

@byjg byjg commented Oct 22, 2026

Copy link
Copy Markdown
Owner

/_headers was missing Host

Go keeps the Host header in r.Host, not in r.Header, so /_headers (and the parking page's headers table) never showed it. It is now added back.

curl -H 'Host: host2.local:19910' localhost:8080/_headers
{"Accept":"*/*","Host":"host2.local:19910","User-Agent":"curl/8.5.0"}

Echo mode

--echo (env ECHO_MODE) answers every path with a JSON description of the request, as it reached the server. It is a test backend for proxies and load balancers: it shows what was forwarded and which instance answered.

{"name":"web-80","hostname":"c122aebc2892","method":"GET","uri":"/any/path?x=1",
 "host":"host2.local:19910","proto":"HTTP/1.1","tls":false,"remote_addr":"172.17.0.1:52662",
 "headers":{"Accept":"*/*","Host":"host2.local:19910","User-Agent":"curl/8.5.0"}}
  • --name (env SERVER_NAME, default the hostname) tells instances apart.
  • No files are served, so --root-dir is not needed.
  • --proxy and --spa are refused with --echo.
  • The health endpoint keeps working.
  • The Helm chart exposes parameters.echoMode and parameters.serverName.

The options that depend on each other moved into config.validate(), so they are covered by tests.

Tests

  • TestHeadersEndpointIncludesHost
  • TestEchoDescribesTheRequest
  • TestEchoAnswersEveryPathButHealth
  • TestValidate

byjg added 2 commits October 22, 2026 11:54
/_headers left out the Host header: Go keeps it in r.Host, not in
r.Header. It is the header a proxy test needs most, so it is now added
back.

--echo (env ECHO_MODE) answers every path with a JSON description of the
request: name, hostname, method, uri, host, proto, tls, remote address
and headers. It is a test backend for proxies and load balancers: it
shows what was forwarded and which instance answered. --name (env
SERVER_NAME, default the hostname) tells instances apart. No files are
served, so --root-dir is not needed; --proxy and --spa are refused. The
health endpoint keeps working.

The options that depend on each other moved into config.validate(), so
they are covered by tests. The Helm chart exposes parameters.echoMode
and parameters.serverName.
@byjg
byjg merged commit 6aeb240 into master Oct 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant