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

Custom proxy upstream health check #324

Closed
kavun opened this issue Nov 7, 2015 · 4 comments
Closed

Custom proxy upstream health check #324

kavun opened this issue Nov 7, 2015 · 4 comments
Labels
feature ⚙️ New feature or request

Comments

@kavun
Copy link

kavun commented Nov 7, 2015

Currently the proxy middleware supports a health check that requests a path and executes the following logic on the response.

host.Unhealthy = r.StatusCode < 200 || r.StatusCode >= 400

What would be the best way to add support for logic to fail the health check if the response content does not match a given regex? My initial thought would be to add another parameter to the health_check like health_check path [duration] [content_regex]. Would a different syntax be clearer?

Thoughts?

@mholt
Copy link
Member

mholt commented Nov 7, 2015

Although I shudder at the thought of the user needing to use and maintain a regex, your proposed syntax is probably how I would do it, if it were to be implemented.

Does it need to be a full-blown regex or can we get away with substring matching? (i.e. look for that string in the response body to be considered healthy)

@mholt mholt added the feature ⚙️ New feature or request label Nov 7, 2015
@kavun
Copy link
Author

kavun commented Nov 7, 2015

Yea you're probably right - for all cases where I've done something similar with other load balancers a simple string substring match has been enough.

Would the syntax have to be this instead since duration would be required if you wanted to supply the content_substring? health_check path [duration [content_substring]] - just trying to make sure this ends up being clean without introducing a breaking change.

@mholt
Copy link
Member

mholt commented Nov 7, 2015

Yeah, duration would be required then.

This isn't ideal but let's try it and see how it goes. Saying '10s' isn't too bad.

@mholt mholt added the help wanted 🆘 Extra attention is needed label Mar 21, 2016
@mholt
Copy link
Member

mholt commented Jan 1, 2017

Kind of looking at expanding this into how Caddy determines whether to retry requests as well. See comments on #1314.

reds pushed a commit to reds/caddy that referenced this issue May 26, 2017
reds pushed a commit to reds/caddy that referenced this issue May 27, 2017
reds pushed a commit to reds/caddy that referenced this issue Jun 6, 2017
reds pushed a commit to reds/caddy that referenced this issue Jun 8, 2017
reds pushed a commit to reds/caddy that referenced this issue Jun 27, 2017
reds added a commit to reds/caddy that referenced this issue Jun 28, 2017
reds added a commit to reds/caddy that referenced this issue Jun 28, 2017
@mholt mholt closed this as completed in 078c991 Jun 28, 2017
@mholt mholt removed the help wanted 🆘 Extra attention is needed label Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature ⚙️ New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants