From 3898b0c5905ea2f90582d4e1d63976fbce95e9d9 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Tue, 26 Jan 2021 19:25:21 +0200
Subject: [PATCH] Collabora online.

---
 conf.d/code.shore.co.il.conf | 69 ++++++++++++++++++++++++++++++++++++
 docker-compose.yml           |  1 +
 2 files changed, 70 insertions(+)
 create mode 100644 conf.d/code.shore.co.il.conf

diff --git a/conf.d/code.shore.co.il.conf b/conf.d/code.shore.co.il.conf
new file mode 100644
index 0000000..9c62ba7
--- /dev/null
+++ b/conf.d/code.shore.co.il.conf
@@ -0,0 +1,69 @@
+map $host $code { default code; }
+
+server {
+    listen      80;
+    listen      [::]:80;
+    server_name code.shore.co.il;
+    include     snippets/robots-disallow-all.conf;
+    include     snippets/ads-txt.conf;
+    include     snippets/security-txt.conf;
+    include     snippets/www-acme-challenge.conf;
+    include     snippets/redirect-https.conf;
+}
+
+server {
+    listen      443 ssl;
+    listen      [::]:443 ssl;
+    server_name code.shore.co.il;
+    include     snippets/robots-disallow-all.conf;
+    include     snippets/ads-txt.conf;
+    include     snippets/security-txt.conf;
+    include     snippets/ssl.conf;
+
+    # The following was copied (and modified) from
+    # https://www.collaboraoffice.com/code/nginx-reverse-proxy/.
+
+    # static files
+    location ^~ /loleaflet {
+        proxy_pass              http://$code:9980$request_uri;
+        proxy_http_version      1.1;
+        include                 snippets/proxy-headers.conf;
+    }
+
+    # WOPI discovery URL
+    location ^~ /hosting/discovery {
+        proxy_pass              http://$code:9980$request_uri;
+        proxy_http_version      1.1;
+        include                 snippets/proxy-headers.conf;
+    }
+
+    # Capabilities
+    location ^~ /hosting/capabilities {
+        proxy_pass              http://$code:9980$request_uri;
+        proxy_http_version      1.1;
+        include                 snippets/proxy-headers.conf;
+    }
+
+    # main websocket
+    location ~ ^/lool/(.*)/ws$ {
+        proxy_pass              http://$code:9980$request_uri;
+        proxy_http_version      1.1;
+        include                 snippets/proxy-headers.conf;
+        include                 snippets/websockets.conf;
+    }
+
+    # download, presentation and image upload
+    location ~ ^/lool {
+        proxy_pass              http://$code:9980$request_uri;
+        proxy_http_version      1.1;
+        include                 snippets/proxy-headers.conf;
+    }
+
+    # Admin Console websocket
+    location ^~ /lool/adminws {
+        proxy_pass              http://$code:9980$request_uri;
+        proxy_http_version      1.1;
+        include                 snippets/proxy-headers.conf;
+        include                 snippets/websockets.conf;
+    }
+}
diff --git a/docker-compose.yml b/docker-compose.yml
index 37dbac9..c73f3c2 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -13,6 +13,7 @@ services:
           - git.shore.co.il
           - lam.shore.co.il
           - mta-sts.shore.co.il
+          - code.shore.co.il
     ports:
       - '80:80'
       - '443:443'
-- 
GitLab