rubenverhoef 11 Posted September 29, 2015 Share Posted September 29, 2015 (edited) Ok that's great. So please now, try the configuration I posted and edited in my previous post. Pay attention to the /emby location and the protocol configuration of the Proxypass directive since it must be ws:// and not http:// Let me know how it goes. EDIT: by the way, which version of Apache and on which distro are you running your proxy? <VirtualHost _default_:443> ServerName www.thuisverhoef.nl ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> <Location /> ProxyPass http://192.168.0.3:8096/ ProxyPassReverse http://192.168.0.3:8096/ </Location> <Location /emby> ProxyPass ws://192.168.0.3:8096/emby ProxyPassReverse ws://192.168.0.3:8096/emby </Location> SSLEngine On SSLCertificateFile "/etc/certificates/www.thuisverhoef.nl_bundle.crt" SSLCertificateKeyFile "/etc/certificates/www.thuisverhoef.nl_bundle.key" </VirtualHost> same issue: (it is dutch Firefox could not connect to : ) I use FreeNas 9.3 stable -emby jail (192.168.0.3) -webserver jail (forwarded to internet (443/80)) apache 2.4 installed with: cd /usr/ports/www/apache24 make install clean Edited September 29, 2015 by rubenverhoef Link to comment Share on other sites More sharing options...
fc7 123 Posted September 29, 2015 Share Posted September 29, 2015 Only thing that I can think off right now is playing with the Websocket config. Please try this configuration instead: <Location /emby> ProxyPass wss://192.168.0.3:8096/emby ProxyPassReverse wss://192.168.0.3:8096/emby </Location> If that doesn't work, try this one but keep in mind that WSS (secure web socket) may not be supported by your Apache websocket module and you may need to compile it yourself: <Location /emby> ProxyPass wss://192.168.0.3:8920/emby ProxyPassReverse wss://192.168.0.3:8920/emby </Location> Also check Apache logs in case there is something interesting there (when switching to wss you may see errors related to SSL handshake between apache and Emby for example) Link to comment Share on other sites More sharing options...
fc7 123 Posted September 29, 2015 Share Posted September 29, 2015 (edited) Oh wait. Look at the URL of the error is not trying to reach /emby?apikey, it's just trying to reach root (/?apikey)? Am I correct? If this is the case then the configuration will not work. Give me some time to check out this behavior. Edited September 29, 2015 by fc7 Link to comment Share on other sites More sharing options...
rubenverhoef 11 Posted September 29, 2015 Share Posted September 29, 2015 Oh wait. Look at the URL of the error is not trying to reach /emby?apikey, it's just trying to reach root (/?apikey)? Am I correct? If this is the case then the configuration will not work. Give me some time to check out this behavior. Yes that is correct, sorry my final setup would like to :https://www.thuisverhoef.nl/emby so i did: ProxyPass /emby http://192.168.0.3:8096/emby ProxyPassReverse /emby http://192.168.0.3:8096/emby but for testing i changed it to the root like your config. Sorry for not telling my first post and config was with /emby in stead of the root of the site. Link to comment Share on other sites More sharing options...
fc7 123 Posted September 29, 2015 Share Posted September 29, 2015 Yes that is correct, sorry my final setup would like to :https://www.thuisverhoef.nl/emby so i did: ProxyPass /emby http://192.168.0.3:8096/emby ProxyPassReverse /emby http://192.168.0.3:8096/emby but for testing i changed it to the root like your config. Sorry for not telling my first post and config was with /emby in stead of the root of the site. Even in that case, if I'm not mistaken, the configuration should instead be something like this: ProxyPass /emby http://192.168.0.3:8096 ProxyPassReverse /emby http://192.168.0.3:8096 Anyway let me check the websocket behavior and post back to this thread once I have something. Link to comment Share on other sites More sharing options...
rubenverhoef 11 Posted September 29, 2015 Share Posted September 29, 2015 Even in that case, if I'm not mistaken, the configuration should instead be something like this: ProxyPass /emby http://192.168.0.3:8096 ProxyPassReverse /emby http://192.168.0.3:8096 Anyway let me check the websocket behavior and post back to this thread once I have something. ProxyPass /emby http://192.168.0.3:8096 ProxyPassReverse /emby http://192.168.0.3:8096 gives the same result like everyting. Thanks for your help so far! Link to comment Share on other sites More sharing options...
rubenverhoef 11 Posted October 5, 2015 Share Posted October 5, 2015 Remote control also didn't work i think the websocket error has to do with it Link to comment Share on other sites More sharing options...
fc7 123 Posted October 5, 2015 Share Posted October 5, 2015 Still no news on my side. Sorry. Sent from my iPhone using Tapatalk Link to comment Share on other sites More sharing options...
rubenverhoef 11 Posted October 5, 2015 Share Posted October 5, 2015 Still no news on my side. Sorry. Sent from my iPhone using Tapatalk no problem, just an update on my side Link to comment Share on other sites More sharing options...
dcrdev 251 Posted October 24, 2015 Share Posted October 24, 2015 I'm probably going to be doing this once I get emby up and running, I deliver most of my webservices via apache reverse proxy. In case you haven't got this working yet - do you have mod_proxy_wstunnel installed/enabled? Also I imagine you'll want SSLProxyEngine On as well. Link to comment Share on other sites More sharing options...
arbraini 1 Posted November 17, 2015 Share Posted November 17, 2015 (edited) I'm also trying to setup an apache reverse proxy for emby. And I am also having an issue setting up the proxy for the emby web sockets. Could the issue be that the similar location is causing a conflict? in my case my proxy looks like: <Location /emby> order deny,allow deny from all allow from all ProxyPass http://192.168.1.201:8096/emby ProxyPassReverse http://192.168.1.201:8096/emby ProxyPass ws://192.168.1.201:8096/emby ProxyPassReverse ws://192.168.1.201:8096/emby </Location> but here is we can see the issue. anything on port 80 with /emby is redirected to http. proxy does not care about the scheme coming in (http or ws) because web sockets is still over port 80 and part of the http protocol As a solution would it be possible to put the websockets connection on a separate endpoint, for example: /embyws ? Edited November 17, 2015 by arbraini Link to comment Share on other sites More sharing options...
fc7 123 Posted November 17, 2015 Share Posted November 17, 2015 I'm also trying to setup an apache reverse proxy for emby. And I am also having an issue setting up the proxy for the emby web sockets. Could the issue be that the similar location is causing a conflict? in my case my proxy looks like: <Location /emby> order deny,allow deny from all allow from all ProxyPass http://192.168.1.201:8096/emby ProxyPassReverse http://192.168.1.201:8096/emby ProxyPass ws://192.168.1.201:8096/emby ProxyPassReverse ws://192.168.1.201:8096/emby </Location> but here is we can see the issue. anything on port 80 with /emby is redirected to http. proxy does not care about the scheme coming in (http or ws) because web sockets is still over port 80 and part of the http protocol I totally agree with you. Even for the sake of clearness the websocket URL should be unique. Something like "ws://emby.mydomain.com:8096/wstunnel" or whatever as far as is different from "/emby". Link to comment Share on other sites More sharing options...
Cerothen 89 Posted November 17, 2015 Share Posted November 17, 2015 (edited) {removed} Edited November 17, 2015 by Cerothen Link to comment Share on other sites More sharing options...
arbraini 1 Posted November 17, 2015 Share Posted November 17, 2015 Thanks Cerothen. Just to clarify mod_proxy_wstunnel is installed on the apache2 instance Considering dependency proxy for proxy_wstunnel: Module proxy already enabled Module proxy_wstunnel already enabled Link to comment Share on other sites More sharing options...
Luke 37086 Posted November 17, 2015 Share Posted November 17, 2015 nything on port 80 with /emby is redirected to http are you certain the same port will be fine? Link to comment Share on other sites More sharing options...
arbraini 1 Posted November 17, 2015 Share Posted November 17, 2015 (edited) I think so but I'm not 100% certain. The <location> block is used as the first parameter for proxypass. the first parameter is the relative path on the domain to capture for the proxy. So `proxypass "/emby" http://192.168.1.201:8096/emby` will capture anything trying to access {domain}/emby and proxy it to http://291.168.1.201:8096/emby If websockets was on a separate endpoint we could capture it separately and proxy it to the proper endpoint as well. If both endpoints were on the same port it should be fine because we are capturing it based on the base relative path `/emby/` and `/embyws/` an example conf would look like: <Location /emby> order deny,allow deny from all allow from all ProxyPass http://192.168.1.201:8096/emby ProxyPassReverse http://192.168.1.201:8096/emby </Location> <Location /embyws> order deny,allow deny from all allow from all ProxyPass ws://192.168.1.201:8096/embyws ProxyPassReverse ws://192.168.1.201:8096/embyws </Location> Edited November 17, 2015 by arbraini 1 Link to comment Share on other sites More sharing options...
fc7 123 Posted November 17, 2015 Share Posted November 17, 2015 Same port will be fine but the URL must be different. I'm already proxing Guacamole that also uses ws and it works fine. Sent from my iPad using Tapatalk Link to comment Share on other sites More sharing options...
alucryd 216 Posted December 28, 2015 Share Posted December 28, 2015 (edited) Has anyone been running emby behind an nginx proxy recently? I have about the same config as the best answer, but music playback always stops after a few seconds with the following error, tried firefox and chrome: net::ERR_INCOMPLETE_CHUNKED_ENCODING Media element error code: 2 It works fine when I forward a port and access emby directly so the issue definitely comes from the reverse proxy. FWIW I already have a working nginx setup serving several other things so I'm not really keen to switch to apache Edit: Disabling proxy buffering in nginx appears to work, fingers crossed. Edited December 28, 2015 by alucryd Link to comment Share on other sites More sharing options...
rubenverhoef 11 Posted January 16, 2016 Share Posted January 16, 2016 any updates about the websocket for apache? Link to comment Share on other sites More sharing options...
curtisghanson 5 Posted February 5, 2016 Share Posted February 5, 2016 (edited) For those who are using apache, I have websockets working. Here is my config file: <VirtualHost *:80> ServerName emby.domain.com UseCanonicalName On Redirect permanent / https://emby.domain.com/ </VirtualHost> <VirtualHost _default_:443> ServerName emby.domain.com UseCanonicalName On <Proxy *> Order deny,allow Allow from all </Proxy> SSLEngine On SSLProxyEngine On SSLProtocol ALL -SSLv2 -SSLv3 SSLHonorCipherOrder On SSLProxyVerify None SSLProxyCheckPeerCN Off SSLProxyCheckPeerName Off SSLProxyCheckPeerExpire Off SSLCertificateFile /etc/letsencrypt/live/emby.domain.com/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/emby.domain.com/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/emby.domain.com/chain.pem SSLCipherSuite ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS ProxyRequests Off ProxyPreserveHost On # # Notice!!! Put me before http!!! # <Location /socket> # ProxyPass ws://localhost:8096/socket # ProxyPassReverse ws://localhost:8096/socket # </Location> # # Notice!!! Put me after ws!!! # <Location /> # ProxyPass http://localhost:8096/ # ProxyPassReverse http://localhost:8096/ # </Location> Header set Connection "Upgrade" RequestHeader setifempty Connection "Upgrade" Header set Upgrade "websocket" RequestHeader setifempty Upgrade "websocket" # Notice!!! Put me before http!!! ProxyPass /socket ws://localhost:8096/socket ProxyPassReverse /socket ws://localhost:8096/socket # Notice!!! Put me after ws!!! ProxyPass / http://localhost:8096/ ProxyPassReverse / http://localhost:8096/ ErrorLog ${APACHE_LOG_DIR}/emby-ssl-error.log CustomLog ${APACHE_LOG_DIR}/emby-ssl-access.log combined </VirtualHost> Notes: I read in a few places that the websocket (ws) directives have to go before your http directives. I tried it and so far it's a true statement. I reversed them and websocket requests failed. I also noticed that my version of Emby sends ws requests to /socket. I don't know if that's new because I don't remember that path being used in the past. Regardless, this is how I configured it. In addition, I have the same ProxyRequests in the Location directives commented out. Either way works, using the Location directives or not. Just swap or remove the commented sections as needed. Note that port 8096 is used for both ws and http. Ws does not use 8945 like I originally worked with. Lastly, it is quite possible many of my directives in my config file are not necessary. I just got tired of experimenting trying to get sockets to work. Bonus. I provided my SSL directives. My server currently get's an "A" on Qualy's SSL Labs Test. So this configuration seems to be working well for me now. Edited for spelling. Edited February 5, 2016 by curtisghanson 2 Link to comment Share on other sites More sharing options...
Luke 37086 Posted February 5, 2016 Share Posted February 5, 2016 Well done Link to comment Share on other sites More sharing options...
zserrbo 0 Posted February 7, 2016 Share Posted February 7, 2016 curtisghanson: It works for me, If I am not wrong. You save my day!!! Very appreciate! Link to comment Share on other sites More sharing options...
rubenverhoef 11 Posted March 10, 2016 Share Posted March 10, 2016 The config from curtisghanson was not working for me because emby was connecting its websocket to /embywebsocket. So i made this config for apache with some code from curtisghanson. Now you can go to www.domain.com/emby without a error in chrome about websockets. Maybe this works for others as well. Header set Connection "Upgrade" RequestHeader setifempty Connection "Upgrade" Header set Upgrade "websocket" RequestHeader setifempty Upgrade "websocket" # Notice!!! Put me before http!!! ProxyPass /embywebsocket ws://192.168.0.3:8096/embywebsocket ProxyPassReverse /embywebsocket ws://192.168.0.3:8096/embywebsocket # Notice!!! Put me after ws!!! ProxyPass /emby http://192.168.0.3:8096/emby ProxyPassReverse /emby http://192.168.0.3:8096/emby Other question, is it possible to use emby connect with reverse proxy so i can close the 8096 port and all the apps are connecting over HTTPS? In the emby server settings i cannot set my outgoing address to https://www.domain.com/emby, i have to specify a port. But https://www.domain.com/emby:443 doesn't work. Does anyone know if this is possible? Link to comment Share on other sites More sharing options...
dcrdev 251 Posted March 10, 2016 Share Posted March 10, 2016 You can't currently work around that limitation. I have Emby set up as a sub domain via an Apache virtual host, this works wonderfully as in Emby it translates to https://media.domain.com:443. Link to comment Share on other sites More sharing options...
rubenverhoef 11 Posted March 10, 2016 Share Posted March 10, 2016 You can't currently work around that limitation. I have Emby set up as a sub domain via an Apache virtual host, this works wonderfully as in Emby it translates to https://media.domain.com:443. that's sadly, i have no ssl certificate to emby.domain.com is this feature coming to emby? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now