1. Output of caddy version
:
# caddy version
v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=
2. How I run Caddy:
Via the APT package.
a. System environment:
Debian 11, SystemD
b. Command:
None - systemd does that for me
c. Service/unit/compose file:
n/a
d. My complete Caddy config:
ingwie.me {
# Matrix:
reverse_proxy /_matrix/* localhost:8008
handle /.well-known/matrix/server {
header Content-Type application/json
header Access-Control-Allow-Origin *
respond `{"m.server": "ingwie.me:443"}`
}
handle /.well-known/matrix/client {
header Content-Type application/json
header Access-Control-Allow-Origin *
respond `{"m.homeserver": {"base_url": "https://ingwie.me:443"}}`
}
# Mastodon:
# root * /srv/mastodon/public
# encode gzip
# @static file
# handle @static {
# file_server
# }
# handle /api/v1/streaming* {
# reverse_proxy localhost:4000
# }
# handle * {
# reverse_proxy localhost:3000
# }
# header {
# Strict-Transport-Security "max-age=31536000;"
# }
# header /sw.js Cache-Control "public, max-age=0";
# header /emoji* Cache-Control "public, max-age=31536000, immutable"
# header /packs* Cache-Control "public, max-age=31536000, immutable"
# header /system/accounts/avatars* Cache-Control "public, max-age=31536000, immutable"
# header /system/media_attachments/files* Cache-Control "public, max-age=31536000, immutable"
# handle_errors {
# @5xx expression `{http.error.status_code} >= 500 && {http.error.status_code} < 600`
# rewrite @5xx /500.html
# file_server
# }
}
3. The problem I’m having:
I want to host my Matrix server and Mastodon on the same domain. I fooled around with the configuration a little bit but between all the handle/proxy statements, my brain is now spaghetti ^^; …
The basics:
- Anything that goes to
/_matrix
should go to my Matrix server. - Everything else should go to Mastodon.
But when I use the config as-is, my Matrix server no longer gets any messages, but Mastodon, does. So I am pretty sure I did something wrong with the order of the statements or something…
4. Error messages and/or full log output:
In-between me messing up the configuration sometimes and actual logs, a long time has passed and I couldn’t spot anything that would hint me what I needed to know. Sorry…
5. What I already tried:
I left my last attempt as commented-out part of the configuration.
6. Links to relevant resources:
None, really.