1. The problem I’m having:
I am trying to reverse proxy using caddy.
Opening the website in a browser results in the below error.
And running curl -vL resaults
* Trying ::1:8888...
* Connected to localhost (::1) port 8888 (#0)
> GET / HTTP/1.1
> Host: localhost:8888
> User-Agent: curl/7.74.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 502 Bad Gateway
< Server: Caddy
< Date: Sun, 06 Aug 2023 11:48:08 GMT
< Content-Length: 0
<
* Connection #0 to host localhost left intact
2. Error messages and/or full log output:
In the console where “sudo caddy run” is run i get
2023/08/06 11:48:08.962 ERROR http.log.error dial tcp [::1]:80: connect: connection refused {"request": {"remote_ip": "::1",
"remote_port": "56542", "client_ip": "::1", "proto": "HTTP/1.1", "method": "GET", "host": "localhost:8888", "uri": "/",
"headers": {"User-Agent": ["curl/7.74.0"], "Accept": ["*/*"]}}, "duration": 0.000601017, "status": 502, "err_id": "5a5gc4k9t", "err_trace": "reverseproxy.statusError (reverseproxy.go:1246)"}
That was all a single line but i tried to get it more readable by making it multiple.
“journalctl -u caddy --no-pager | less +G” results in
-- Journal begins at Thu 2023-07-27 20:30:00 EEST, ends at Sun 2023-08-06 14:51:12 EEST. --
-- No entries --
I did not run debug because I did not understand where I was supposed to put it
3. Caddy version:
v2.7.3 h1:eMCNjOyMgB5A1KgOzT2dXKR4I0Va+YHCJYC8HHu+DP0=
4. How I installed and ran Caddy:
Using Install — Caddy Documentation debian/ubuntu/raspbian stable
Debian 11, x86_64
b. Command:
sudo caddy run
c. Service/unit/compose file:
what does this mean?
d. My complete Caddy config:
http://localhost:8888 {
debug
}
route /docpht* {
uri strip_prefix /docpht
reverse_proxy localhost:8008
}
route /fenrus* {
uri strip_prefix /fenrus
reverse_proxy localhost:3000
}
route /portainer* {
uri strip_prefix /portainer
reverse_proxy localhost:9000
}
route /WeTTY* {
uri strip_prefix /WeTTY
reverse_proxy localhost:3030
}
route / {
uri strip_prefix /
reverse_proxy localhost:80
}