1. Output of caddy version
:
v2.6.1 h1:EDqo59TyYWhXQnfde93Mmv4FJfYe00dO60zMiEt+pzo=
2. How I run Caddy:
I am using docker-compose with a caddy and matrixdotorg/synapse image.
a. System environment:
Docker on Bodhi Linux
b. Command:
sudo docker-compose up -d
c. Service/unit/compose file:
version: '3'
services:
synapse:
image: matrixdotorg/synapse:latest
container_name: synapse
restart: unless-stopped
volumes:
- /home/me/Docker/Synapse/data:/data
environment:
- SYNAPSE_SERVER_NAME=synhang.host
- SYNAPSE_REPORT_STATS=no
- VIRTUAL_HOST=synhang.ddns.net
caddy:
image: caddy:latest
container_name: synapse-caddy
restart: unless-stopped
ports:
- 80:80
- 443:443
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- ./site:/srv
- ./caddy_data:/data:rw
- ./caddy_config:/config:rw
d. My complete Caddy config:
synhang.ddns.net {
tls myemail@proton.me
reverse_proxy /chat synapse:8008
file_server browse
}
3. The problem I’m having:
Basically I want to serve static content to all requests to synhang.ddns.net, however, if a request goes to synhang.ddns.net/chat i want it to reverse proxy to the synapse container.
With the Caddyfile shown above I can see static content when I load https://synhang.ddns.net but when I try to go to https://synhang.ddns.net/chat/ I get 404 No Such Resource error. I thought the issue might just be because the chat directory didn’t exist, so I went ahead and made one. Still get the same error
If I have the following Caddyfile, It serves the synapse server just fine.
synhang.ddns.net {
tls myemail@proton.me
reverse_proxy synapse:8008
}
What am I not doing right?
4. Error messages and/or full log output:
Paste logs/commands/output here.
USE THE PREVIEW PANE TO MAKE SURE IT LOOKS NICELY FORMATTED.