Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cop_auth: host domain should respond to ping #65

Merged

Conversation

jphines
Copy link
Contributor

@jphines jphines commented Sep 20, 2018

Problem

We identified a strange bug in our routing logic in which the /ping endpoint was getting a 404 if and only if we used the configured host in the request. So any requests that used any other host responded with a 200 🐛.

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 and 404'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

@jphines jphines merged commit 3cdb6bb into master Sep 20, 2018
@jphines jphines deleted the jhines-cop-auth-passed-domain-should-respond-to-ping branch September 20, 2018 18:00
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.

2 participants