Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

SlidingSync does not work when hosted on path other than / (root) #12658

Closed
wants to merge 1 commit into from

Conversation

dreske
Copy link

@dreske dreske commented Jun 20, 2024

When sliding-sync is hostet on the same domain, but in a sub path, the url resolution will fail.

Example:
base domain: matrix.example.com
sliding-sync: matrix.example.com/sliding-sync

the URL constructur new URL("/client/server.json", proxyUrl) will create the url matrix.example.com/client/server.json and not as required matrix.example.com/sliding-sync/client/server.json.

Removing the leading slash from the will solve the issue as per the documentation https://developer.mozilla.org/en-US/docs/Web/API/URL/URL

@dreske dreske requested a review from a team as a code owner June 20, 2024 09:49
@dreske dreske requested review from richvdh and robintown June 20, 2024 09:49
@github-actions github-actions bot added the Z-Community-PR Issue is solved by a community member's PR label Jun 20, 2024
Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spec specifies the path as an absolute, so the MSC would need clarifying to allow this

@dreske
Copy link
Author

dreske commented Jun 20, 2024

This is our https://example.com/.well-known/matrix/client

{
    "org.matrix.msc3575.proxy": {
        "url": "https://matrix.exampe.com/sliding-sync"
    }
}

But element is trying to load https://matrix.exampe.com/client/server.json which fails because of the constructur behaviour.

@dreske
Copy link
Author

dreske commented Jun 20, 2024

I can't follow you.
We've used the default ansible workbook installation and that creates this configuration. Where is the error?

@t3chguy
Copy link
Member

t3chguy commented Jun 20, 2024

The MSC states that the path is as such

image

It says nothing about it supporting being at a subpath. The ansible script letting this be configured as such is not in line with the MSC.

@richvdh
Copy link
Member

richvdh commented Jun 25, 2024

I'm rather confused.

But element is trying to load https://matrix.exampe.com/client/server.json which fails because of the constructur behaviour.

I don't see any reference to an object called server.json in either the MSC (https://github.com/matrix-org/matrix-spec-proposals/blob/kegan/sync-v3/proposals/3575-sync.md) or the CS API spec (https://spec.matrix.org/v1.11/client-server-api/).

What am I missing?

@dreske
Copy link
Author

dreske commented Jun 25, 2024

I'm rather confused.

But element is trying to load https://matrix.exampe.com/client/server.json which fails because of the constructur behaviour.

I don't see any reference to an object called server.json in either the MSC (https://github.com/matrix-org/matrix-spec-proposals/blob/kegan/sync-v3/proposals/3575-sync.md) or the CS API spec (https://spec.matrix.org/v1.11/client-server-api/).

What am I missing?

I was not talking about the MSC, but the implementation in element and the react sdk. They are loading the server.json to get the URL of the sync service. So I thought this is the way to do it.

@richvdh richvdh changed the title SlidingSync does not work when hostet on path other than / (root) SlidingSync does not work when hosted on path other than / (root) Jun 25, 2024
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this endpoint isn't documented anywhere, I don't think the react-sdk should be supporting it at all.

@t3chguy
Copy link
Member

t3chguy commented Jun 25, 2024

If this endpoint isn't documented anywhere, I don't think the react-sdk should be supporting it at all.

It is a healthcheck endpoint for the sliding sync proxy for whilst the implementation on both sides is unstable, this check was added by @kegsay originally

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Z-Community-PR Issue is solved by a community member's PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants