1. Caddy version (caddy version
):
v2.1.1 h1:X9k1+ehZPYYrSqBvf/ocUgdLSRIuiNiMo7CvyGUQKeA=
2. How I run Caddy:
a. System environment:
Running in docker on a Raspberry Pi 3, using the --network host
flag
b. Command:
c. Service/unit/compose file:
d. My complete Caddyfile or JSON config:
s1.mydomain.com {
reverse_proxy localhost:8080
}
s2.mydomain.com {
reverse_proxy 192.168.1.130:7000
}
api.s2.mydomain.com {
reverse_proxy 192.168.1.130:7001
}
3. The problem I’m having:
I am trying to use the reverse proxy directive to forward the traffic to another machine on the network. The directive works fine if the service is on the same machine as caddy. Whenever I try to forward it to another machine, I get a blank page.
This Caddyfile is not complete, I have a few other services running on another machine and even on that machine I see the blank page.
This setup worked perfectly in Caddy v1, but in Caddy v2 I get a blank page, and a 502 error. The services are all up and I can easily access them from inside the network by using the IP address of the machine.
4. Error messages and/or full log output:
{“level”:“error”,“ts”:1600363452.75425,“logger”:“http.log.error”,“msg”:“dial tcp 192.168.1.130:7000: i/o timeout”,“request”:{“method”:“GET”,“uri”:"/",“proto”:“HTTP/2.0”,“remote_addr”:“92.104.148.75:62032”,“host”:“s1.mydomain.com”,“headers”:{“Accept-Language”:[“en-US,en;q=0.5”],“Accept-Encoding”:[“gzip, deflate, br”],“Dnt”:[“1”],“Cache-Control”:[“no-cache”],“Te”:[“trailers”],“Accept”:[“text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8”],“Upgrade-Insecure-Requests”:[“1”],“Pragma”:[“no-cache”],“User-Agent”:[“Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:80.0) Gecko/20100101 Firefox/80.0”]},“tls”:{“resumed”:false,“version”:772,“ciphersuite”:4867,“proto”:“h2”,“proto_mutual”:true,“server_name”:“s1.mydomain.com”}},“duration”:10.001566026,“status”:502,“err_id”:“5i3xdqi6k”,“err_trace”:“reverseproxy.(*Handler).ServeHTTP (reverseproxy.go:411)”}
5. What I already tried:
I tried the following things:
-
caddy validate
: Output is clean, the file seems to be correct - Tried removing the docker image and using the docker exec on the raspi, nothing changed
- Checked firewall settings, everything seems to work
- Read the docs (again and again…)