Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ToxicFrog opened this issue Jan 23, 2024 · 0 comments
Open

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

ToxicFrog opened this issue Jan 23, 2024 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@ToxicFrog
Copy link
Contributor

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.

@progval progval added bug Something isn't working good first issue Good for newcomers labels Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants