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

Media proxy does not seem to be getting used #294

Closed
spantaleev opened this issue Aug 10, 2024 · 1 comment
Closed

Media proxy does not seem to be getting used #294

spantaleev opened this issue Aug 10, 2024 · 1 comment

Comments

@spantaleev
Copy link
Contributor

In 9d11271d59a054, I've worked on adapting matrix-docker-ansible-deploy to your v1.15.0 release which is supposed to run a media proxy serving /_heisenbridge/media/* paths and being exposed publicly under media_url.

Our intention (expectation) is to:

  • have the playbook expose Heisenbridge at a /heisenbridge path prefix by default (e.g. media_url = https://matrix.DOMAIN/heisenbridge). This is configurable - some users may wish to dedicate a hostname to Heisenbridge and not use a path prefix (e.g. media_url = https://heisenbridge.DOMAIN)
  • have Heisenbridge generate URLs like this: {media_url}/_heisenbridge/media/something. Examples:
    • (Matrix hostname + path prefix) https://matrix.DOMAIN/heisenbridge/_heisenbridge/media/something
    • (dedicated hostname, without path prefix) https://heisenbridge.DOMAIN/_heisenbridge/media/something
  • have the playbook's reverse-proxy strip the optional path prefix (e.g. /heisenbridge) and pass whatever remains (e.g. /_heisenbridge/media/*) to the Heisenbridge server

It seems like currently Heisenbridge still generates URLs destined for the Matrix Media API, looking like this: {media_url}/_matrix/media/v3/download/DOMAIN/FILE_ID/FILE_NAME. Unless media_url is pointed to the homeserver URL, this cannot work.


Is there something else that needs to be done to enable the media proxy functionality? Is it possible only enabled for certain media and not other?

Perhaps us adding an additional /heisenbridge prefix and putting it in the media_url configuration key is not compatible with Heisenbridge's expectations.

It's probably most straightforward if Heisenbridge always proxied all media, instead of constructing 2 different types of URLs (sometimes leading to the Media API, sometimes leading to the media proxy).

@tulir
Copy link
Collaborator

tulir commented Aug 10, 2024

There's only one way of constructing URLs, not two. However, the media path is configurable too (heisenbridge -> media_path). I guess the config can technically be used to bypass the new proxy, but by default the proxy is always used. If the media path hasn't been overridden, then the most likely explanation is that the bridge wasn't actually updated.

@tulir tulir closed this as completed Sep 8, 2024
spantaleev added a commit to spantaleev/matrix-docker-ansible-deploy that referenced this issue Sep 12, 2024
Related to:

- #3518
- hifi/heisenbridge#294

With this patch, when `matrix_heisenbridge_path_prefix` is the default
one we use (`/heisenbrdige`), URLs like this are constructed:

https://matrix.DOMAIN/heisenbridge/_heisenbridge/media/SERVER_NAME/MEDIA_ID/CHECKSUM/FILENAME

If `matrix_heisenbridge_path_prefix` is set to `/`, URLs like this are constructed:

https://matrix.DOMAIN/_heisenbridge/media/SERVER_NAME/MEDIA_ID/CHECKSUM/FILENAME

Our Traefik labels support handling both cases correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants