Traefik Version: 1.6.4
My company uses Docker Swarm to present applications as services, using Traefik for routing. All has been working fine so far, but we're having trouble implementing backend health checks in Traefik.
All of our applications expose a health check, which works fine and returns 200 via a simple curl or hitting it in a web browser. We've applied Docker labels to our swarm services to reflect these health checks. As an example:
traefik.backend.healthcheck.path=/health
traefik.backend.healthcheck.interval=30s
The Traefik service logs report the following:
{"level":"warning","msg":"Health check still failing. Backend: \"backend-for-my-app\" URL: \"https://10.0.0.x:8080\" Reason: received non-200 status code: 406","time":"2018-07-10T19:41:25Z"}
Within the app containers we have Apache running with ModSecurity. ModSecurity is blocking the request because the host header is a numeric IP address. I shelled into the Traefik container and did a couple curls against the app container to test:
curl -k https://10.0.0.x:8080/health
<-- ModSecurity blocks this, returns a 406curl -k -H "Host: myapp.company.com" https://10.0.0.x:8080/health
<-- works fine, returns a 200
TLDR: I need a way to set a host header for the Traefik backend health check. In Traefik docs, I don't see a way of doing this. Has anyone run into this issue, and/or know of a solution?