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

Provide example Nginx reverse-proxy config for new media-proxy? #1820

Open
poVoq opened this issue Sep 9, 2024 · 4 comments
Open

Provide example Nginx reverse-proxy config for new media-proxy? #1820

poVoq opened this issue Sep 9, 2024 · 4 comments

Comments

@poVoq
Copy link

poVoq commented Sep 9, 2024

The media proxy seems to be working as expected, but I am still having some issue finding the right config for the reverse-proxy to serve the files on a sub-directory.

I can imagine that others will have the same issue, so it would be nice if there was a sample config for Nginx provided in this repo.

Thanks!

Edit: hmm, no can't get it to work. Always a 502 gateway error. Any tips appreciated.

@poVoq
Copy link
Author

poVoq commented Sep 10, 2024

So I was told that this should work with Nginx:

    location /media/ {
        proxy_pass http://127.0.0.1:11111/;

        proxy_set_header X-Forwarded-For $remote_addr;
    }

But I still get a 502 error when I try that with my setup proxying to the address of the container instead.

Is it possible that appservice-irc only listens on localhost? That obviously can't work in Docker containers or when the reverse-proxy isn't on the same machine.

@voice06
Copy link

voice06 commented Sep 10, 2024

Thats from my setup, I did take a quick look at the code for media-proxy and it looks like it will always start the service on 0.0.0.0.

The question becomes what is your publicUrl set to? For that nginx location example and my server I have it set to:
publicUrl: "https://matrix.randomsonicnet.org/media"

You'll probably need to tinker around with the media-proxy and nginx config till it just works since thats basically what I ended up doing.

Also before I forget, currently homeserver.url has to be http, https is currently not supported from the errors I got.

@poVoq
Copy link
Author

poVoq commented Sep 10, 2024

Ok that is good to know that it listens on 0.0.0.0. so running it in a container should be fine then.

I guess I need to get back to trail and error with my Nginx then.

@poVoq
Copy link
Author

poVoq commented Sep 25, 2024

Ok, I figured out what the issue was (the pod didn't allow access to port 11111, stupid me), but now I always get a "cannot GET /media/v1/...." error.

The Url displayed in the error seems to be correct, so I wonder what the issue might be now.

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