Hello,
I’ve set up an OnlyOffice server as a shared service in an environment where multiple frontend (FE) and backend (BE) installations are running on a Docker host. Inside my web-application the OnlyOffice frontend loads successfully, but I encounter the following error when trying to open a file:
“An error has occurred while opening the file. The file content does not match the file extension.”
The file itself can be downloaded in the browser directly using our file download service (auth_request in location of file server is temporarly deactivated for testing).
Additionally, running docker logs -f
for the OnlyOffice container doesn’t show any logs while attempting to open the file as well as the log files themselfes do not have got any entries.
Here is how the OnlyOffice component is being called from the frontend:
<DocumentEditor
id="onlyoffice-editor"
documentServerUrl={`${process.env.REACT_APP_URL}api/office`}
config={{
document: {
fileType: 'docx', // temporarly hard-coded for testing purpose
key: `file-${new Date().getTime()}`,
title: 'Test',
url: fileUrl, // pointing to our file download service
},
documentType: 'word', // temporarly hard-coded for testing purpose
editorConfig: {
mode: 'view',
...
},
}}
...
/>
Here is the docker-compose.yml
configuration for the up and running container:
services:
onlyoffice:
image: onlyoffice/documentserver:latest
container_name: development_office
restart: always
ports:
- "3019:80"
stdin_open: true
environment:
- JWT_ENABLED=false
- JWT_SECRET=test
- JWT_HEADER=Authorization
- ENABLE_TLS=false
volumes:
- ./office/logs/:/var/log/onlyoffice
- ./office/data/:/var/www/onlyoffice/Data
networks:
- "application/network:development"
networks:
"application/network:development":
external: true
Additionally, here is the relevant NGINX location configuration for OnlyOffice on the Docker host:
location /api/office/ {
# auth_request /backend/public/services/authenticate;
# error_page 401 = /error401;
proxy_pass http://localhost:3019/; # Backend for ONLYOFFICE
proxy_http_version 1.1;
# WebSocket Headers
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Forwarding Headers
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Buffering Settings for WebSocket
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Accel-Buffering 'no';
proxy_buffering off;
chunked_transfer_encoding off;
# Rewrite for Compatibility
rewrite ^/api/office/(.*) /$1 break;
}
Has anyone encountered this issue before or can offer guidance on how to resolve it? I’ve already checked relevant posts and the guides for setting things up containered. Any insights or suggestions would be greatly appreciated!
Thanks in advance.
Marc