quickmic 1394 Posted October 15, 2018 Share Posted October 15, 2018 (edited) I run Emby behind a apache proxy and works fine beside I get no access to embywebsocket. Not sure what's the problem, logs (on emby server) says all the time: 2018-10-15 20:22:31.484 Info HttpServer: HTTP Response 404 to xxx.xxx.xxx.xxx. Time: 0ms. http://multimedia.myserver.net/embywebsocket?device_id=1F2AC72B44084E599F696FA755963705 2018-10-15 20:22:32.880 Info HttpServer: HTTP GET http://multimedia.myserver.net/embywebsocket?device_id=A5D85C77455B43FEB0DBF48FCDE9E9A3. UserAgent: 2018-10-15 20:22:32.880 Error HttpServer: Could not find handler for /embywebsocket 2018-10-15 20:22:32.880 Info HttpServer: HTTP Response 404 to xxx.xxx.xxx.xxx. Time: 0ms. http://multimedia.myserver.net/embywebsocket?device_id=A5D85C77455B43FEB0DBF48FCDE9E9A3 Any ideas where this issue comes from? Just focus, this is the log on emby server! So the request seems forwarded from apache proxy correctly. Edited October 15, 2018 by quickmic Link to comment Share on other sites More sharing options...
Luke 37351 Posted October 15, 2018 Share Posted October 15, 2018 Hi there, are you experiencing a problem? Link to comment Share on other sites More sharing options...
quickmic 1394 Posted October 15, 2018 Author Share Posted October 15, 2018 No, it works perfect. Just lots of error messages which seems odd. Link to comment Share on other sites More sharing options...
Luke 37351 Posted October 15, 2018 Share Posted October 15, 2018 @@pir8radio may have some tips on proxy setup. Thanks ! Link to comment Share on other sites More sharing options...
pir8radio 1294 Posted October 15, 2018 Share Posted October 15, 2018 (edited) I run Emby behind a apache proxy and works fine beside I get no access to embywebsocket. Not sure what's the problem, logs (on emby server) says all the time: 2018-10-15 20:22:31.484 Info HttpServer: HTTP Response 404 to xxx.xxx.xxx.xxx. Time: 0ms. http://multimedia.myserver.net/embywebsocket?device_id=1F2AC72B44084E599F696FA755963705 2018-10-15 20:22:32.880 Info HttpServer: HTTP GET http://multimedia.myserver.net/embywebsocket?device_id=A5D85C77455B43FEB0DBF48FCDE9E9A3. UserAgent: 2018-10-15 20:22:32.880 Error HttpServer: Could not find handler for /embywebsocket 2018-10-15 20:22:32.880 Info HttpServer: HTTP Response 404 to xxx.xxx.xxx.xxx. Time: 0ms. http://multimedia.myserver.net/embywebsocket?device_id=A5D85C77455B43FEB0DBF48FCDE9E9A3 Any ideas where this issue comes from? Just focus, this is the log on emby server! So the request seems forwarded from apache proxy correctly. I'm not the best with apache there are a few out here that use it for their reverse proxy, I'm an nginx fan.. But did you load the websockets proxy module? I think its something like mod_proxy_wstunnel.so I think @@fc7 runs apache? Maybe he has some input too? Edited October 15, 2018 by pir8radio Link to comment Share on other sites More sharing options...
quickmic 1394 Posted October 16, 2018 Author Share Posted October 16, 2018 well the tunnel module is loaded: root@proxy:~# apachectl -M Loaded Modules: core_module (static) so_module (static) watchdog_module (static) http_module (static) log_config_module (static) logio_module (static) version_module (static) unixd_module (static) access_compat_module (shared) alias_module (shared) auth_basic_module (shared) authn_core_module (shared) authn_file_module (shared) authz_core_module (shared) authz_host_module (shared) authz_user_module (shared) autoindex_module (shared) deflate_module (shared) dir_module (shared) env_module (shared) filter_module (shared) headers_module (shared) mime_module (shared) mpm_event_module (shared) negotiation_module (shared) proxy_module (shared) proxy_html_module (shared) proxy_http_module (shared) proxy_wstunnel_module (shared) reqtimeout_module (shared) rewrite_module (shared) setenvif_module (shared) socache_shmcb_module (shared) ssl_module (shared) status_module (shared) xml2enc_module (shared) Apache config is: <VirtualHost *:443> ServerName multimedia.myserver.net ServerSignature off SSLProxyEngine On SSLProxyVerify none SSLProxyCheckPeerCN off SSLProxyCheckPeerName off SSLProxyCheckPeerExpire off ProxyRequests Off SSLEngine On SSLCertificateFile /mnt/storage0/ssl-signed/certificate.crt SSLCertificateKeyFile /mnt/storage0/ssl-signed/privatekey.pem SSLCACertificateFile /usr/local/share/ca-certificates/cacert.org/class3.crt SSLProtocol all -SSLv2 -SSLv3 -TLSv1.1 -TLSv1 SSLHonorCipherOrder on SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS" UseCanonicalName On SetEnv proxy-nokeepalive 1 SetEnv proxy-sendchunked 1 ProxyPreserveHost On Header set Connection "Upgrade" RequestHeader setifempty Connection "Upgrade" Header set Upgrade "websocket" RequestHeader setifempty Upgrade "websocket" <Proxy *> AddDefaultCharset off Order Allow,Deny Allow from all </Proxy> <Location /embywebsocket> ProxyPass ws://192.168.0.203:80/embywebsocket ProxyPassReverse ws://192.168.0.203:80/embywebsocket </Location> <Location "/"> ProxyPass http://192.168.0.203:80/ ProxyPassReverse http://192.168.0.203:80/ </Location> </VirtualHost> <VirtualHost *:80> ServerName multimedia.myserver.net RewriteEngine on RewriteCond %{SERVER_NAME} =multimedia.myserver.net RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent] </VirtualHost> I tried also couple of variations of the site-configuration, but never solved the issue with embywebsocket. Link to comment Share on other sites More sharing options...
Eriya 4 Posted November 14, 2018 Share Posted November 14, 2018 I just noticed I'm experiencing this too. 2018-11-13 23:36:15.348 Info HttpServer: HTTP GET http://media.kd0bpv.name:8096/embywebsocket?deviceId=<redacted>. UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0 2018-11-13 23:36:15.352 Error HttpServer: Could not find handler for /embywebsocket 2018-11-13 23:36:15.364 Info HttpServer: HTTP Response 404 to <redacted>. Time: 41ms. http://media.kd0bpv.name:8096/embywebsocket?deviceId=<redacted> My virtual host config: <VirtualHost *:80> ServerAdmin <redacted> ServerName media.kd0bpv.name DocumentRoot / <Directory /> Options FollowSymLinks AllowOverride None </Directory> # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn RewriteEngine on RewriteCond %{SERVER_NAME} =media.kd0bpv.name RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost> <IfModule mod_ssl.c> <VirtualHost *:443> ServerAdmin <redacted> ServerName media.kd0bpv.name DocumentRoot / <Directory /> Options FollowSymLinks AllowOverride None </Directory> AllowEncodedSlashes NoDecode SSLProxyEngine On SSLProxyVerify None SSLProxyCheckPeerCN Off SSLProxyCheckPeerName Off ProxyRequests off ProxyPreserveHost on ProxyPass / http://127.0.0.1:8096/ retry=0 ProxyPassReverse / http://127.0.0.1:8096/ ProxyPass "/embywebsocket" "ws://127.0.0.1:8096/embywebsocket" ProxyPassReverse "/embywebsocket" "ws://127.0.0.1:8096/embywebsocket" # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn # SSL Engine Switch: # Enable/Disable SSL for this virtual host. SSLEngine on <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> SSLCertificateFile /etc/letsencrypt/live/media.kd0bpv.name/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/media.kd0bpv.name/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf </VirtualHost> </IfModule> Link to comment Share on other sites More sharing options...
Luke 37351 Posted November 14, 2018 Share Posted November 14, 2018 sounds like your proxy is redirecting ws to http. Link to comment Share on other sites More sharing options...
Eriya 4 Posted November 14, 2018 Share Posted November 14, 2018 With the help of https://dwst.github.io/, I've been able to verify that you're correct. I must have something mis-configured in Apache. The question is, what? I have a few ideas to try... Link to comment Share on other sites More sharing options...
mastrmind11 717 Posted November 14, 2018 Share Posted November 14, 2018 Arent there explicit ws ports exposed? That looks like you're passing ws to 8096, which is http. Link to comment Share on other sites More sharing options...
Luke 37351 Posted November 14, 2018 Share Posted November 14, 2018 It's the same port. Link to comment Share on other sites More sharing options...
laie_techie 12 Posted November 14, 2018 Share Posted November 14, 2018 You need to define the embywebsocket proxy first, otherwise you should get a warning about your alias or proxy is hidden by a previous declaration. Link to comment Share on other sites More sharing options...
Eriya 4 Posted November 14, 2018 Share Posted November 14, 2018 Laie_techie: LOL! I love it that we arrived at the same solution via different routes. You were exactly right. Wish I had seen your post sooner. For some stupid reason, I never thought to check the Apache logs *facepalm*. Anyways, here's how my virtual host config for Emby settled out: <VirtualHost *:80> ServerAdmin <redacted> ServerName media.kd0bpv.name DocumentRoot / <Directory /> Options FollowSymLinks AllowOverride None </Directory> # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn RewriteEngine on RewriteCond %{REQUEST_SCHEME} =http RewriteCond %{SERVER_NAME} =media.kd0bpv.name RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] RewriteCond %{REQUEST_SCHEME} =ws RewriteCond %{SERVER_NAME} =media.kd0bpv.name RewriteRule ^ wss://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost> <IfModule mod_ssl.c> <VirtualHost *:443> ServerAdmin <redacted> ServerName media.kd0bpv.name DocumentRoot / <Directory /> Options FollowSymLinks AllowOverride None </Directory> AllowEncodedSlashes NoDecode SSLProxyEngine On SSLProxyVerify None SSLProxyCheckPeerCN Off SSLProxyCheckPeerName Off ProxyRequests off ProxyPreserveHost on ProxyPass "/embywebsocket" "wss://127.0.0.1:8920/" ProxyPassReverse "/embywebsocket/" "wss://127.0.0.1:8920/" ProxyPass "/" "https://127.0.0.1:8920/" retry=0 ProxyPassReverse "/" "https://127.0.0.1:8920/" # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn # SSL Engine Switch: # Enable/Disable SSL for this virtual host. SSLEngine on <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> SSLCertificateFile /etc/letsencrypt/live/media.kd0bpv.name/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/media.kd0bpv.name/privkey.pem Include /etc/letsencrypt/options-ssl-apache.conf </VirtualHost> </IfModule> Websockets are now working correctly. Thanks all! 1 Link to comment Share on other sites More sharing options...
laie_techie 12 Posted November 15, 2018 Share Posted November 15, 2018 Other thoughts: Your VirtualHost listening on port 80 ALWAYS redirects to https on port 443, but you only define a VirtualHost on port 443 if mod_ssl.c is loaded. Your port 80 vhost should probably also include a section for when mod_ssl.c is not loaded which includes your emby proxy information, too. You probably do not want to use your root directory as DocumentRoot (and especially don't want to enable symlinks there), but that's mostly harmless seeing how every possible URL is being proxied elsewhere. <VirtualHost *:80> ServerAdmin <redacted> ServerName media.kd0bpv.name # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn <IfModule mod_ssl.c> RewriteEngine on RewriteCond %{REQUEST_SCHEME} =http RewriteCond %{SERVER_NAME} =media.kd0bpv.name RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] RewriteCond %{REQUEST_SCHEME} =ws RewriteCond %{SERVER_NAME} =media.kd0bpv.name RewriteRule ^ wss://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </IfModule> <IfModule !mod_ssl.c> ProxyPass "/embywebsocket" "wss://127.0.0.1:8920/" ProxyPassReverse "/embywebsocket/" "wss://127.0.0.1:8920/" ProxyPass "/" "https://127.0.0.1:8920/" retry=0 ProxyPassReverse "/" "https://127.0.0.1:8920/" </IfModule> </VirtualHost> 1 Link to comment Share on other sites More sharing options...
Eriya 4 Posted November 17, 2018 Share Posted November 17, 2018 Yeah, I definitely need to clean up all of my vhost configs. heh. I just haven't gotten to it yet. I appreciate your input on the mod_ssl stuff. I'll keep it in mind for other sites I run, but this is just a personal server, and I don't want it to ever be accessed unencrypted from the internet side, so I'm actually happy with it failing altogether if somehow mod_ssl isn't loaded. 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