Jump to content

WSS Apache Reverse Proxy


Recommended Posts

Posted (edited)

Hello everyone!

 

I hope you all doing well today.

 

It's been a pretty long time I am using Emby and the was does not seem to work through Apache Reverse proxy.

 

I am not able to do some actions from any device /apps/browsers. For example I cannot remove a downloaded file through the app. I got the confirmation asking if I want to remove and after that I only see a spinning wheel. That happen when I want to change some settings as well for the Live TV for exemple.

 

When I connect to Emby with its local IP and port, it's working fine.

 

This issue is ongoing since I am using emby and I was never able to resolve.

 

My Apache conf is separated into two vhost. emby.conf for http and emby-le-ssl for https.

 

I checked in that forum and I tried to apply the solution I found without any luck.

 

I tried to search any wss connection in Emby logs and I can see an error 404 for /embywebsocket.

 

I am running the latest version of Emby Server and the Emby client as well.

 

Thank you very much for your help guys!

embyserver.txt

emby.conf.txt

emby-le-ssl.conf.txt

Edited by jcbdrs
Posted

Hi, if you check @@pir8radio profile he has a link to his nginx configuration. I realize you're running different software but you can probably pick up something from that. Please let us know if this helps. Thanks.

Posted

Thank you for your quick reply Luke!

 

I tested something similar in the http vhost:

RewriteCond %{HTTP:Connection} Upgrade [NC]

RewriteCond %{HTTP:Upgrade} websocket [NC]

RewriteRule ^/?(.*)$ ws://192.168.0.110:8096/$1 [P,L]

 

It does not work either.

 

Thank you!

pir8radio
Posted (edited)

Thank you for your quick reply Luke!

 

I tested something similar in the http vhost:

RewriteCond %{HTTP:Connection} Upgrade [NC]

RewriteCond %{HTTP:Upgrade} websocket [NC]

RewriteRule ^/?(.*)$ ws://192.168.0.110:8096/$1 [P,L]

 

It does not work either.

 

Thank you!

 

 

Thats why i like nginx..   :)    Apache needs some websocket module enabled to work.   I think its something like mod_proxy_wstunnel    google that see if it helps at all?   If i recall correctly it wont work with emby because emby doesnt have a websocket path,  like  embyserver.com/websocket/     emby uses something more like embyserver.com/websocket?parms=      Maybe see if you can make that work.. some kind of wild card after /websocket* 

Edited by pir8radio
Posted

Thank you for your help!

 

I enabled the mod for ws and it's running.

 

I can confirm Emby is using site.com/embywebsocket

 

That's what I have in the log.

 

I am gonna try with a wildcard since it's /embywebsocket?something

 

Thank!

Posted

Still not working with a wildcard :/

Posted

What exactly happened?

Posted

I am still getting am error 404 in the log for site.com/embywebsocket.

pir8radio
Posted

I am still getting am error 404 in the log for site.com/embywebsocket.

 

what log?   in chrome/developer tools?

Posted

I tested the config and it's not working for me...

I tried to change few things such as putting a trail after or modifying the url.

I checked in my Apache config and I disabled all custom config.

I am still getting the exact same thing. I don't know if it's because I am using TLS 1.3?

Thanks for your help guys!

Posted (edited)

Ok now that's what I get when I try to remove a download job from the app using the remote url :

 

2019-08-05 05:57:27.157 Info HttpServer: HTTP Response 404 to 45.42.98.2. Time: 0ms. "http ://192.168.0.110:8096/socket?deviceId=af38e1417c1a3d9d"

 

It's the same through web and it's working fine using the local url.

 

I test that with another network to make sure there is no conflict.

Edited by jcbdrs
Posted

 

 

2019-08-05 05:57:27.157 Info HttpServer: HTTP Response 404 to 45.42.98.2. Time: 0ms. "http ://192.168.0.110:8096/socket?deviceId=af38e1417c1a3d9d"

The problem is the protocol. Notice how it is http. It should be ws.

Posted

How can I resolve that?

 

I tried to create a proxy rule similar to embywebsocket without any luck!

Posted

Well the answer will be in your proxy configuration. The request comes from the Emby app as 

ws://192.168.0.110:8096/socket?deviceId=af38e1417c1a3d9d

And then your proxy intercepts it and sends this to emby server:

http://192.168.0.110:8096/socket?deviceId=af38e1417c1a3d9d
Posted

Hi, I just wanted to share my experiences with using the Apache Webserver as reverse proxy with emby... the short summary: I ended up in using nginx.

While I was able to use the apache Webserver as reverse Proxy while apache was running on the same machine as emby, I was not able to reverse-proxy the connection as soon as emby and apache run on different machines.
I've tried to enable several modules from apache, but every time, I got a "forbidden" msg.

Don't know why - maybe, it was somehow related to my server configs and the containers I am running - but after switching to nginx, everything was working as expected without any complicated workarounds.

 

Maybe, you should also give it a try with nginx...

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...