zorchenhimer / MovieNight

Single instance video streaming server with integrated chat.
https://discord.gg/F2VSgjJ
MIT License
683 stars 87 forks source link

Apache Reverse Proxy Issue #149

Open andrewfer000 opened 3 years ago

andrewfer000 commented 3 years ago

Apache has a small reverse proxy issue with the websocket / chat. There are no Apache errors, but the website says "The connection to the server has closed. Please refresh page to connect again" even though the connection to the site is fine and the stream plays. MovieNight outputs:

[ERROR] 2021/01/15 10:05:36 Error upgrading to websocket: websocket: the client is not using the websocket protocol: 'upgrade' token not found in 'Connection' header

Also other questions:

  1. Is there a way to embed the stream into my main site?
  2. Is there a way to make a service to automatically start and run MovieNight as a system service?

I'm sure other people figured out the Daemon thing already so I'm sure that can be answered. But I hope my other things can be solved! Thank You.

Besides that stuff, so far so good! Movie Night makes a great replacement for the per-hosted proprietary "apps" out there!

zorglube commented 3 years ago

Hello,

I can't help you for the reverse-proxy issue, I use Nginx as reverse-proxy and it work fine. Keep in mind I had to setup the websoket-reverse-proxy-passthrought (I don't know if it the right capabilitie name).

About the daemon solution. I daemonize MovieNight with FreeBSD & daemon and it work fine. You can find exemple here.

See ya, Zorglube

zorchenhimer commented 3 years ago

Apparently Apache doesn't have out-of-the-box support for websockets. According to this post you need the proxy and proxy_wstunnel modules installed and enabled. I don't run Apache myself, so I can't be much more help than that.

As for embedding the stream into your main site, that "should" be possible. You'd have to copy/paste a bunch of code from static/main.html (everything that isn't inside an {{ if .Chat }} block basically). This isn't an aim of this project, so your mileage may vary.

Lastly, there unfortunately aren't any daemonization scripts for this project yet. Some cleanup needs to be done before they can really be cleanly written too (thinks like graceful shutdown). That said I do want to eventually get that setup, I'm just not sure when "eventually" will be.