From: Ismaƫl Bouya Date: Fri, 10 May 2019 23:48:52 +0000 (+0200) Subject: Fix peertube websockets X-Git-Tag: nur_publish~35 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;ds=sidebyside;h=f826c67c0ff51c9724e8f54da6c9cbef78977858;p=perso%2FImmae%2FConfig%2FNix.git Fix peertube websockets --- diff --git a/nixops/modules/websites/tools/peertube.nix b/nixops/modules/websites/tools/peertube.nix index ab5e08a..a9f06cc 100644 --- a/nixops/modules/websites/tools/peertube.nix +++ b/nixops/modules/websites/tools/peertube.nix @@ -159,17 +159,20 @@ in { hosts = [ "peertube.immae.eu" ]; root = null; extraConfig = [ '' + RewriteEngine On + + RewriteCond %{REQUEST_URI} ^/socket.io [NC] + RewriteCond %{QUERY_STRING} transport=websocket [NC] + RewriteRule /(.*) ws://localhost:${env.listenPort}/$1 [P,NE,QSA,L] + + RewriteCond %{REQUEST_URI} ^/tracker/socket [NC] + RewriteRule /(.*) ws://localhost:${env.listenPort}/$1 [P,NE,QSA,L] + ProxyPass / http://localhost:${env.listenPort}/ ProxyPassReverse / http://localhost:${env.listenPort}/ ProxyPreserveHost On RequestHeader set X-Real-IP %{REMOTE_ADDR}s - - ProxyPass /tracker/socket ws://127.0.0.1:${env.listenPort}/tracker/socket - ProxyPassReverse /tracker/socket ws://127.0.0.1:${env.listenPort}/tracker/socket - - ProxyPass /socket.io ws://127.0.0.1:${env.listenPort}/socket.io - ProxyPassReverse /socket.io ws://127.0.0.1:${env.listenPort}/socket.io '' ]; }; };