OnlyOffice Document Server integration demo
  • HTML 54.5%
  • JavaScript 43.8%
  • Dockerfile 1.7%
Find a file
Frontend Agent 8c89648645 Initial commit: OnlyOffice integration with docker-compose
- Docker Compose setup with OnlyOffice, Node.js app, and nginx proxy
- WebSocket support for real-time collaboration
- Sample documents (docx, xlsx, pptx)
- JWT disabled for demo purposes
- Private IP access allowed for Docker networking
- nginx reverse proxy with proper WebSocket handling
- Comprehensive README with setup instructions
2026-04-05 10:39:23 +00:00
docker/onlyoffice-config Initial commit: OnlyOffice integration with docker-compose 2026-04-05 10:39:23 +00:00
nginx Initial commit: OnlyOffice integration with docker-compose 2026-04-05 10:39:23 +00:00
node-app Initial commit: OnlyOffice integration with docker-compose 2026-04-05 10:39:23 +00:00
.gitignore Initial commit: OnlyOffice integration with docker-compose 2026-04-05 10:39:23 +00:00
docker-compose.yml Initial commit: OnlyOffice integration with docker-compose 2026-04-05 10:39:23 +00:00
README.md Initial commit: OnlyOffice integration with docker-compose 2026-04-05 10:39:23 +00:00

OnlyOffice Integration Demo

A demonstration of integrating OnlyOffice Document Server with a Node.js application, proxied through nginx with WebSocket support.

Architecture

Browser → SSH Tunnel → nginx (port 9001) → Node.js App (port 3001)
                                    → OnlyOffice (port 8080→80)
  • nginx: Reverse proxy handling both static files and OnlyOffice with WebSocket support
  • Node.js: Serves the demo app UI and document files, handles OnlyOffice callbacks
  • OnlyOffice Document Server: Provides the document editing engine

Prerequisites

  • Docker & Docker Compose
  • SSH access to the host machine (for tunneling)

Quick Start

1. Start the services

cd onlyoffice-integration
docker-compose up -d

2. Create SSH tunnel (from your local machine)

ssh -L 9001:localhost:9001 user@your-server

3. Access the demo

Open your browser: http://localhost:9001/viewer.html?file=sample.docx

Available sample documents:

  • sample.docx - Word document
  • sample.xlsx - Excel spreadsheet
  • sample.pptx - PowerPoint presentation

Project Structure

onlyoffice-integration/
├── docker-compose.yml          # Docker Compose configuration
├── docker/
│   └── onlyoffice-config/
│       └── local.json          # OnlyOffice server configuration
├── node-app/
│   ├── Dockerfile              # Node.js app Docker image
│   ├── package.json            # Node.js dependencies
│   ├── server.js               # Express-like HTTP server
│   ├── index.html              # Demo landing page
│   ├── viewer.html             # Document viewer/editor page
│   ├── sample.docx             # Sample Word document
│   ├── sample.xlsx             # Sample Excel spreadsheet
│   └── sample.pptx             # Sample PowerPoint
├── nginx/
│   └── onlyoffice-demo.conf    # nginx reverse proxy config
└── README.md                   # This file

Key Configuration

OnlyOffice (docker/onlyoffice-config/local.json)

  • JWT tokens disabled - No authentication required for demo
  • Private IP access allowed - Enables callbacks from Docker network
  • No secrets - Open access for testing

nginx (nginx/onlyoffice-demo.conf)

  • Proxies / to Node.js app
  • Proxies /onlyoffice/ to OnlyOffice with WebSocket support
  • Rewrites redirects from localhost to proper paths
  • Extended timeouts for long-running document edits

Node.js App (node-app/server.js)

  • Serves static HTML files
  • Serves sample documents with correct MIME types
  • Handles OnlyOffice callback endpoint (/demo/callback)
  • Proxies OnlyOffice API requests

Docker Networking

The containers communicate via the onlyoffice-net bridge network:

  • Node.js app: node-app:3001
  • OnlyOffice: onlyoffice:80
  • nginx: listens on port 9001

OnlyOffice reaches the Node.js app using the Docker service name node-app, which resolves internally within the Docker network.

Troubleshooting

WebSocket connection failed

  1. Ensure nginx WebSocket proxy headers are set correctly
  2. Check that ds:docservice is running: docker exec onlyoffice-documentserver supervisorctl status
  3. Verify nginx config: docker exec onlyoffice-nginx-proxy nginx -t

"Document could not be saved"

  1. Check OnlyOffice logs: docker logs onlyoffice-documentserver
  2. Verify callback URL is reachable from OnlyOffice container
  3. Check Node.js app logs: docker logs onlyoffice-demo-app

"No rights for action"

JWT tokens might be enabled. Verify local.json has:

"token": {
  "enable": {
    "browser": false
  }
}

OnlyOffice not starting

Wait 30-60 seconds after container start - OnlyOffice takes time to initialize all services.

Development

Rebuild after changes

docker-compose down
docker-compose build --no-cache
docker-compose up -d

View logs

docker-compose logs -f

Access individual containers

docker exec -it onlyoffice-documentserver bash
docker exec -it onlyoffice-demo-app sh
docker exec -it onlyoffice-nginx-proxy sh

Security Notes

⚠️ This is a demo configuration with security disabled:

  • JWT authentication is disabled
  • No HTTPS/TLS
  • Open access to all endpoints

For production use:

  1. Enable JWT tokens with strong secrets
  2. Use HTTPS with valid certificates
  3. Restrict access with authentication
  4. Set up proper firewall rules
  5. Enable OnlyOffice rate limiting

License

MIT