Skip to content

M51 doesn't follow redirects when locating the homeserver #60

Open
@ToxicFrog

Description

@ToxicFrog

My homeserver runs on matrix.ancilla.ca. In order to use it without the leading matrix., the webserver at ancilla.ca serves redirects on the .well-known/matrix directory:

$ curl -i https://ancilla.ca/.well-known/matrix/client
HTTP/2 301 
location: https://matrix.ancilla.ca/.well-known/matrix/client

This works fine for Element, but M51 doesn't follow the redirect (linebreaks added and HTML removed for clarity):

10:06:59.150 [warning] Well-known request for https://ancilla.ca/.well-known/matrix/client returned
  %HTTPoison.Response{
    status_code: 301,
    body: "[elided]",
    headers: [{"Date", "Tue, 23 Jan 2024 15:06:59 GMT"}, {"Server", "Apache"}, {"Access-Control-Allow-Origin", "*"}, {"Location", "https://matrix.ancilla.ca/.well-known/matrix/client"}, {"Cache-Control", "max-age=600"}, {"Expires", "Tue, 23 Jan 2024 15:16:59 GMT"}, {"Content-Length", "259"}, {"Content-Type", "text/html; charset=iso-8859-1"}],
    request_url: "https://ancilla.ca/.well-known/matrix/client",
    request: %HTTPoison.Request{method: :get, url: "https://ancilla.ca/.well-known/matrix/client", headers: [], body: "", params: %{}, options: []}}.
  Falling back to https://ancilla.ca

Which obviously doesn't work. I've tried it with both 301 and 302 without success.

I can fix it temporarily by copying the .well-known from matrix.ancilla.ca to ancilla.ca and turning off the redirect, but M51 should handle redirects itself. I'm pretty rusty on Erlang but I'm pretty sure this is just a matter of setting follow_redirect to true when making the initial request via httpoison.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions