cop_auth: host domain should respond to ping #65
Merged
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.
Problem
We identified a strange bug in our routing logic in which the
/ping
endpoint was getting a404
if and only if we used the configured host in the request. So any requests that used any other host responded with a200
🐛.This is a result of the way we've set up our mux in combination with go's default mux handling. Patterns that match a
host
domains take precedent, so when the mux receives the request with the host we've configured, it walks down the mux subtree that matched with the host and404
's since we haven't set up a handler for/ping
in that mux subtree.However, if we use a host that is not configured, the pattern does not match on the
host
domain and falls into our catchall which we've configured to respond to/ping
requests.Solution
We configure
/ping
on the configured host patterns also.Notes
So
/ping
should now respond to all domains, regardless of what the host was passed in the request.cc @pyoio