-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Add HTTP headers to healthcheck. #3047
Conversation
This is still WIP I am adding healthchecks "healthcheck": {
"path": "/",
"interval": "5s",
"headers": {
"Host": "foobar.com",
"header1": "test",
"headeR2": "test2"
}
}, I can see in logs However, still I am not able to see Host header in another server.
I am thinking might this cause this issue still golang/go#7682 |
package main
import (
"fmt"
"net/http"
"os"
)
func main() {
client := &http.Client{}
req, err := http.NewRequest("GET", "http://localhost:8000", nil)
if err != nil {
os.Exit(1)
}
req.Header.Add("User-Agent", "myClient")
req.Header.Add("Host", "leet.com")
resp, err := client.Do(req)
defer resp.Body.Close()
fmt.Println(resp)
} Does not change host header to leet.com. Cool :). So is this golang bug? |
Got it working, its little bit tricky in Host header. Is these tests and docs enough or do we need more? I have no idea how to fix these tests:
|
Thanks for your contribution! I understand your use case with the Do you think you can just add "hostname option" and remove other headers option? |
@juliens IMO headers are useful for instance if the healthcheck needs authentication. So I do not see why we could not add those in same PR |
@zetaab After discussion with the team, we agree to add both But we think we need to separate hostname from the headers. "healthcheck": {
"path": "/",
"interval": "5s",
"hostname": "foobar.com",
"headers": {
"header1": "test",
"headeR2": "test2"
}
}, Moreover, we need the functionnality to be added on every providers. If you need help, you can share with us on our Slack workspace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zetaab Could rebase your PR on the master branch.
Also, you have to take this feature available by the labels and the KV:
- edit templates: https://github.com/containous/traefik/tree/master/templates
- run
go generate
- edit those sections:
- Add tests for all providers (except Kubernetes)
could someone review these test, I cannot now find the problem(s). To get tests working edit: now tests are working locally, but ECS provider tests are failing to some another reasons |
@zetaab Could you also update the doc for each provider, thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your patience and your responsiveness. We really enjoyed that.
LGTM 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
http headers working
remove rowchanges add gofmt
fix tests fix tests2
dbba535
to
5b68923
Compare
What does this PR do?
Tries to fix issue #3043
Motivation
We need this feature, describe in issue
More
Additional Notes
Fixes #3043