matrix-org / matrix-federation-tester

Tester for matrix federation written in golang.
77 stars 17 forks source link

federation tester does not return valid result #114

Closed djschilling closed 3 years ago

djschilling commented 3 years ago

Describe the bug The federation tester does not use the host header to check matrix server. That's my guess.

To Reproduce https://federationtester.matrix.org/api/report?server_name=chat.church.tools

the following error occurs: msg=Failed to GET JSON (hostname \"chat.church.tools:443\" path \"/_matrix/federation/v1/version\"): <html><body><h1>503 Service Unavailable</h1>\nNo server is available to handle this request.\n</body></html>\n code=503 wrapped=

But i can access my server through curl with the ip by passing the correct host header:

curl --insecure --header "host: chat.church.tools" https://116.202.120.126:443/_matrix/federation/v1/version
{
    "server": {
        "name": "Synapse",
        "version": "1.23.0"
    }

i have to use the insecure flag because curl does not respect the host header when checking the ssl certificate.

Expected behavior the tester should give a positive result

Screenshots

Bildschirmfoto 2021-03-11 um 12 30 14
richvdh commented 3 years ago

I'm pretty sure it does send a Host header. perhaps you could capture the request you receive on your server to see what's wrong.

richvdh commented 3 years ago

looks like it's sending a Host header of chat.church.tools:443. That's as specced; see https://matrix.org/docs/spec/server_server/latest#resolving-server-names.

I'm going to go ahead and close this because I don't think it's a problem with the federationtester. If you can give more details about exactly what you think the federation tester is doing wrong (having first checked against the spec), we can reopen it.

djschilling commented 3 years ago

@richvdh thanks for the clarification. i actually read the spec, but oversaw that the port is also sent as host header. i fixed it on my server and its now valid.