caddy-docker-proxy to host port
I'm running cockpit on port 9090 on my host machine.
In a docker container on the host is the caddy-docker-proxy.
The reverse proxy (RP) container is linked to the host ports 80 and 443.
Is there any way I can use the caddy-docker-proxy to access port 9090 on the host machine?
I've tried using the cockpit-ws docker image but it doesn't contain the webserver and as such I have the same issue.
I don't know how I might add a custom caddyfile to the RP nor how I might create a dummy container.
See related github issue
Solution 1:
I've added a few lines to the caddy docker-compose.yml and altered the host cockpit conf file:
docker-compose.yml:
extra_hosts:
- "host.docker.internal:host-gateway"
labels:
caddy: pluto.thechubbypanda.net
caddy.reverse_proxy: "host.docker.internal:9090"
/etc/cockpit/cockpit.conf:
[WebService]
AllowUnencrypted = true
ProtocolHeader = X-Forwarded-Proto