Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

fix(docker:nginx): optionalize OnlyOffice proxying and avoid startup failure when container is absent

johaven2be107feda42
diff --git a/docker/config/nginx/docker-compose.nginx.yaml b/docker/config/nginx/docker-compose.nginx.yaml
index 4bba9e78..5fa24a3c 100644
--- a/docker/config/nginx/docker-compose.nginx.yaml
+++ b/docker/config/nginx/docker-compose.nginx.yaml
@@ -5,6 +5,7 @@ services:
restart: always
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
+ - ./onlyoffice.conf:/etc/nginx/onlyoffice.conf
ports:
- "80:80"
logging:
@@ -15,5 +16,4 @@ services:
depends_on:
- sync_in
networks:
- - sync_in_network
-
+ - sync_in_network
\ No newline at end of file
diff --git a/docker/config/nginx/nginx.conf b/docker/config/nginx/nginx.conf
index d1afa602..9dc9f919 100644
--- a/docker/config/nginx/nginx.conf
+++ b/docker/config/nginx/nginx.conf
@@ -2,7 +2,7 @@
map $request_uri $xfp {
# This header must be null on webdav uri
- # It causes authentication problems with Microsoft-WebDAV-MiniRedir (Windows)
+ # It causes authentication failures with Microsoft-WebDAV-MiniRedir (Windows)
~^/webdav(?:/.*)? "";
default $scheme;
}
@@ -75,19 +75,6 @@ server {
proxy_pass http://sync_in_server;
}
- location ^~ /onlyoffice/ {
- proxy_pass http://onlyoffice:80/;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Host $host/onlyoffice;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_set_header Host $host;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection $connection_upgrade;
- proxy_no_cache 1;
- proxy_cache_bypass 1;
- }
-
location ~* .(ico|jpg|png|gif|jpeg|swf|woff|svg)$ {
# nginx always use the most accurate rule in its internal routing policies
proxy_pass http://sync_in_server;
@@ -96,4 +83,9 @@ server {
expires 1d;
add_header Cache-Control public;
}
+
+ # NOTE: This is only needed when the OnlyOffice Docker container is running locally
+ # and you are not using an external URL.
+ # Uncomment the line below to enable it:
+ # include onlyoffice.conf;
}
\ No newline at end of file
diff --git a/docker/config/nginx/onlyoffice.conf b/docker/config/nginx/onlyoffice.conf
new file mode 100644
index 00000000..17baea25
--- /dev/null
+++ b/docker/config/nginx/onlyoffice.conf
@@ -0,0 +1,12 @@
+location ^~ /onlyoffice/ {
+ proxy_pass http://onlyoffice:80/;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Host $host/onlyoffice;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header Host $host;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection $connection_upgrade;
+ proxy_no_cache 1;
+ proxy_cache_bypass 1;
+}
\ No newline at end of file