I had it two times now that a missing or wrong public_baseurl value in Synapse’s config caused trouble only in some cases. This might be a me issue entirely because I configure my reverse proxy to answer /.well-known/matrix/* requests.
Notably the POST v3/login success result will return a base_url that clients SHOULD prefer even. I’m not sure if this is meant to be for split DNS configurations or similar, so other than this requiring valid credentials to check comparing might not be the best idea.
What is a promising way to discover the base_url and introduce a check that validates expected behavior is using rendezvous like this:
# Use previously discovered client endpoint
$ curl -X POST https://matrix.nwex.de/_matrix/client/unstable/org.matrix.msc4108/rendezvous -H "Content-Type: text/plain"
# ... will return what the server thinks its reachable on.
# This needs to be publically reachable for rendezvous to work
{"url":"https://matrix.nwex.de/_synapse/client/rendezvous/01KZ8NBE364X0ZC483XHPR2QBQ"}
$ curl -I https://matrix.nwex.de/_synapse/client/rendezvous/01KZ8NBE364X0ZC483XHPR2QBQ
HTTP/2 200
# ...