Hi everyone,
I’m having a persistent issue with ONLYOFFICE Document Server and I would really appreciate some help from the community, especially regarding Apache reverse proxy configuration.
Environment
-
ONLYOFFICE Document Server running in Docker
-
Backend app running on port
3000 -
Reverse proxy with Apache + HTTPS
-
Public domain (anonymized):
docs.example.com
Main issue
The editor opens, but the document does not load/save correctly.
I consistently get 401 Unauthorized errors on both the callback and download endpoints.
Logs (anonymized)
Here are the exact relevant logs with document names anonymized:
[WARN] io.connection_error code=3, message=Bad request,
url=/doc/<DOCUMENT_KEY>/c/?shardkey=<DOCUMENT_KEY>&EIO=4&transport=websocket
[ERROR] postData error:
url = http://172.17.0.1:3000/onlyoffice-docs/documents/callback
data = {
"key":"<DOCUMENT_KEY>",
"status":1,
"users":["1"],
"actions":[{"type":1,"userid":"1"}],
"token":"<JWT_TOKEN>"
}
AxiosError: Request failed with status code 401
[ERROR] error downloadFile:
url=http://172.17.0.1:3000/onlyoffice-docs/download/<DOCUMENT_NAME>
attempt=1
AxiosError: Request failed with status code 401
[ERROR] error downloadFile:
attempt=2
status code 401
[ERROR] error downloadFile:
attempt=3
status code 401
Important detail
I already removed all middleware / auth guards from my backend routes.
So I do not think this is caused by application middleware.
Even with no middleware, ONLYOFFICE still gets 401.
Apache reverse proxy config
I would also like feedback on my Apache proxy configuration, especially for WebSocket support.
Current config:
<VirtualHost *:443>
ServerName docs.example.com
SSLEngine on
ProxyPreserveHost On
SSLProxyEngine on
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Ssl on
ProxyPassMatch "^/(.*)/ws$" "ws://127.0.0.1:8080/$1/ws"
ProxyPass "/doc/" "http://127.0.0.1:8080/doc/"
ProxyPassReverse "/doc/" "http://127.0.0.1:8080/doc/"
ProxyPass / "http://127.0.0.1:8080/"
ProxyPassReverse / "http://127.0.0.1:8080/"
SSLCertificateFile /path/to/fullchain.pem
SSLCertificateKeyFile /path/to/privkey.pem
</VirtualHost>
Questions
-
Does this Apache reverse proxy config look correct for ONLYOFFICE?
-
Is there anything missing for WebSocket handling?
-
Could a proxy misconfiguration cause these repeated 401 responses?
-
Has anyone experienced similar issues with Docker + Apache?
At this point I am unsure whether the issue comes from:
-
ONLYOFFICE JWT config
-
backend callback validation
-
Apache proxy / websocket config
Any advice would be greatly appreciated.
Thank you. to external storage)