Repository navigation
Add echo mode; include Host in /_headers - #5
Merged
Merged
Conversation
/_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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/_headerswas missingHostGo keeps the Host header in
r.Host, not inr.Header, so/_headers(and the parking page's headers table) never showed it. It is now added back.Echo mode
--echo(envECHO_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(envSERVER_NAME, default the hostname) tells instances apart.--root-diris not needed.--proxyand--spaare refused with--echo.parameters.echoModeandparameters.serverName.The options that depend on each other moved into
config.validate(), so they are covered by tests.Tests
TestHeadersEndpointIncludesHostTestEchoDescribesTheRequestTestEchoAnswersEveryPathButHealthTestValidate