Closed kidcuauh closed 3 years ago
Please use markdown code formatting when posting issues. It's very hard to read your configs and logs, because whitespace wasn't preserved.
I did a new test with curl to know if my reverse proxy container can communicate with one of the replicas (I tested both) and there is no problem, so there is something else that prevents the reverse proxy working properly.
/ # curl -Iv 8dc5681142ff
* Trying 10.0.3.15:80...
* TCP_NODELAY set
* Connected to 8dc5681142ff (10.0.3.15) port 80 (#0)
> HEAD / HTTP/1.1
> Host: 8dc5681142ff
> User-Agent: curl/7.67.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Accept-Ranges: bytes
Accept-Ranges: bytes
< Content-Length: 9765
Content-Length: 9765
< Content-Type: text/html; charset=utf-8
Content-Type: text/html; charset=utf-8
< Etag: "qynu9g7j9"
Etag: "qynu9g7j9"
< Last-Modified: Mon, 30 Aug 2021 16:10:28 GMT
Last-Modified: Mon, 30 Aug 2021 16:10:28 GMT
< Server: Caddy
Server: Caddy
< Date: Wed, 01 Sep 2021 04:10:06 GMT
Date: Wed, 01 Sep 2021 04:10:06 GMT
<
* Connection #0 to host 8dc5681142ff left intact
Am I missing something in the config?
Ah, right. The issue is your quotes here:
- caddy_0.reverse_proxy="{{upstreams 80}}"
The quotes are being preserved in the Caddyfile, which makes Caddy try to connect to a single upstream literally called 10.0.3.15:80 10.0.3.18:80
which doesn't make sense.
See at the bottom of this section, the note about quotes: https://github.com/lucaslorentz/caddy-docker-proxy#upstreams
Thanks! I confirm it works.
The note says quotes should only be used with yaml which I think I'm using. Also, following all examples in folder are with quotes since it's a yaml file: https://github.com/lucaslorentz/caddy-docker-proxy/blob/master/examples/standalone.yaml
Reverse proxy works good avoiding replicas. It's a frontend Vuetify app docker service running under caddy:2.4.3-alpine The reverse proxy is running latest stable lucaslorentz/caddy-docker-proxy:2.3.5-alpine
vuetify.yaml with 2 replicas:
Log reverse-proxy:
Error log: