From f826c67c0ff51c9724e8f54da6c9cbef78977858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sat, 11 May 2019 01:48:52 +0200 Subject: Fix peertube websockets --- nixops/modules/websites/tools/peertube.nix | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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 '' ]; }; }; -- cgit v1.2.3