drio
(David)
March 23, 2022, 7:45pm
1
I am trying to migrate a nginx config file to caddy. How can I rewrite this?
...
location /.well-known/matrix/client {
add_header Access-Control-Allow-Origin '*';
return 200 '{ "m.homeserver": { "base_url": "domain here" } }';
}
...
P.S: Let me know if you are running your matrix homeserver with Caddy. Love to hear from you.
matt
(Matt Holt)
March 23, 2022, 8:41pm
2
Very easy, please see the docs: Caddyfile Directives — Caddy Documentation
handle /.well-known/matrix/client {
header Access-Control-Allow-Origin *
respond `{ "m.homeserver": { "base_url": "domain here" } }`
}
2 Likes
Since I run multiple matrix servers, if figured I put my two cents in here
If you wanna get all fancy, you could do the following to group both the /.well-known/matrix/client
and /.well-known/matrix/server
:
## matrix client/server delegation
handle_path /.well-known/matrix/* {
header Access-Control-Allow-Origin *
## `Content-Type: application/json` isn't required by the matrix spec
## but some browsers (firefox) and some other tooling might preview json
## content prettier when they are made aware via Content-Type
header Content-Type application/json
respond /client `{ "m.homeserver": { "base_url": "https://client-endpoint.example.com" } }`
respond /server `{ "m.server": "federation-endpoint.example.com:443" }`
## return http/404 if nothing matches
respond 404
}
The port in /server
is, and I quote the synapse docs here :
Note, specifying a port is optional. If no port is specified, then it defaults to 8448.
After I wrote the post here, I was curious whether the synapse docs have a client/server delegation example for Caddy.
And they do!
→ synapse/docs/reverse_proxy.md at e78d4f61fc881851ab35e9a889239a61cf9805e5 · matrix-org/synapse · GitHub
They set the Content-Type
header too, in addition to Access-Control-Allow-Methods
and Access-Control-Allow-Headers
, which aren’t necessary either, but feel free to add them if you like
And they opted to use Caddyfile#snippets with import (Caddyfile directive) — Caddy Documentation which works too, if you prefer that.
4 Likes
drio
(David)
March 24, 2022, 10:53am
4
Thank you @emilylange !
I forgot to check the synapse docs (I use dendrite). On that note, have you tried it? It seems it has been in beta forever. Not sure if I should use synapse instead. I was captivated with the idea of using less resources.
emilylange
(Emily Lange)
March 24, 2022, 11:58am
5
I only run/maintain synapse servers right now
I also kinda love how synapse still has
Help!! Synapse is slow and eats all my RAM/CPU!
in its README
But it is the only spec-complete implementation as of right now.
Both Dendrite (Matrix/Element people) and Conduit (famedly) are still lacking some Server2Server and Client2Server APIs.
→ dendrite/README.md at d983d17355584b7de086389e069a935f1a5510a1 · matrix-org/dendrite · GitHub
→ Issues · matrix-org/dendrite · GitHub
→ README.md · a2a7c6187228bbcbbefadaa703e5afe469b7cbfe · Famedly / Conduit · GitLab
→ Conduit 1.0 · Milestones · Famedly / Conduit · GitLab
Dendrite is becoming more and more complete, but it will still take a while before it is truly complete.
All the cool p2p demos are built on dendrite though (Matrix.org - This Week in Matrix 2022-03-18 ) and (Redirect ) and (https://matrix.org/blog/2021/05/06/introducing-the-pinecone-overlay-network ).
I can’t really speak for Conduit because I don’t follow its development as much.
Oh, and most experimental MSCs [Matrix Spec Changes] usually land in synapse first, if you care about that.
So I would argue, stick with synapse for your main matrix.org server for now and maybe run another implementation on a separate (sub-) domain
1 Like
drio
(David)
March 24, 2022, 12:13pm
6
! Thank you @emilylange .
Do you hang out in any public matrix room? I’d love to join.
-drd
1 Like
Glad I could help
I only really lurk in public matrix rooms, but if you are searching rooms via Element Web/Desktop (onboarding is a bit rough):
Click on the little compass icon next to your search bar/icon top-left
Click on the Matrix rooms (<server name>) dropdown if you aren’t seeing any rooms (or wanna discover another public server)
Either select an existing one or click Add a new server… and add another server like matrix.org
, mozilla.org
, libera.chat
, gitter.im
or smaller ones like ungleich.ch
.
Now you should be able to see at least some public rooms
Alternatively, you could join/discover Spaces like matrix:#community:matrix.org . If you want to learn more about Spaces the following blog post by Element might be a good summary:
drio
(David)
March 24, 2022, 1:18pm
8
I understand we have public rooms in matrix. I wanted to know if you hang out in any of those so I can join too.
Thank you!
system
(system)
Closed
April 22, 2022, 7:45pm
9
This topic was automatically closed after 30 days. New replies are no longer allowed.