ONLYOFFICE 7.0: online forms, password protection in sheets, collaboration improvements and much more
ONLYOFFICE 7.0 released

Document Server & Traefik v2

Do you want to: Ask a how-to question (or Report a bug not so sure)
Document Server version: How do I check?
Type of installation of the Document Server: docker
OS: docker
Browser version: Firefox 96.0.3

Hello, I’m trying to setup document server in my server at address docs.example. com behind traefik v2. All of this using the docker-compose guide
The guide works well without traefik, but when starting traefik and commenting the ports section as shown below, the documents do not load. When creating a new doc in the example page, I’m redirected to a new tab at https://docs.example.com/editor?fileName=new.docx and I get the error “Cannot GET /editor”.
However, I can go back to the example page and open the example document that was created, this opens the editor but the document does not load. Resulting in this error

.

Please help :slight_smile:

docker-compose.yml

version: '2'
services:
  onlyoffice-documentserver:
    build:
      context: .
    container_name: onlyoffice-documentserver
    depends_on:
      - onlyoffice-postgresql
      - onlyoffice-rabbitmq
    environment:
      - DB_TYPE=postgres
      - DB_HOST=onlyoffice-postgresql
      - DB_PORT=5432
      - DB_NAME=onlyoffice
      - DB_USER=onlyoffice
      - AMQP_URI=amqp://guest:guest@onlyoffice-rabbitmq
      # Uncomment strings below to enable the JSON Web Token validation.
      #- JWT_ENABLED=true
      #- JWT_SECRET=secret
      #- JWT_HEADER=Authorization
      #- JWT_IN_BODY=true
#    ports:
#      - '80:80'
#      - '443:443'
    stdin_open: true
    restart: always
    stop_grace_period: 60s
    networks:
      onlyOfficeInternal:
      traefik:
    volumes:
       - /var/www/onlyoffice/Data
       - /var/log/onlyoffice
       - /var/lib/onlyoffice/documentserver/App_Data/cache/files
       - /var/www/onlyoffice/documentserver-example/public/files
       - /usr/share/fonts
    labels:
      - traefik.enable=true
      - traefik.http.routers.docs.rule=Host(`docs.example.com`)
      - traefik.http.routers.docs.tls=true
      - traefik.http.routers.docs.tls.certresolver=le
      - traefik.http.services.docs.loadbalancer.server.port=80
      - traefik.http.routers.docs.service=docs
      - traefik.http.routers.docs.entrypoints=websecure
      - traefik.docker.network=traefik
      - traefik.http.routers.docs-http.entrypoints=web
      - traefik.http.routers.docs-http.rule=Host(`docs.example.com`)
      - traefik.http.routers.docs-http.middlewares=https-redirect
       
  onlyoffice-rabbitmq:
    container_name: onlyoffice-rabbitmq
    image: rabbitmq
    restart: always
    networks:
      onlyOfficeInternal:
    expose:
      - '5672'

  onlyoffice-postgresql:
    container_name: onlyoffice-postgresql
    image: postgres:9.5
    networks:
      onlyOfficeInternal:
    environment:
      - POSTGRES_DB=onlyoffice
      - POSTGRES_USER=onlyoffice
      - POSTGRES_HOST_AUTH_METHOD=trust
    restart: always
    expose:
      - '5432'
    volumes:
      - postgresql_data:/var/lib/postgresql

volumes:
  postgresql_data:

networks:
  onlyOfficeInternal:
  traefik:
    external: true

Hello,
I’d recommend connecting the Document Server to some other service to check the functionality as our embedded example service is not intended to work behind a proxy.
Also please make sure to follow our Traefik example configs for correct proxying to the Document Server:

Hi, @IrArevalo
Do you find solution?

I’ve had this working using docker-compose.yml and also using a file provider for Traefik (the same rules apply, but using YAML instead of labels for the file provider).

You need to set up some middleware headers:

http:
  routers:
    onlyoffice:
      tls:
        certResolver: "cloudflare"
      entrypoints:
        - "websecure"
      rule: "Host(`onlyoffice.mydomain.co.uk`)"
      service: "onlyoffice"
      middlewares: "onlyoffice-headers"
      
  services:
    onlyoffice:
      loadBalancer:
        servers:
          - url: "http://192.168.1.12/"
  
  middlewares:
    onlyoffice-headers:
      headers:
        customRequestHeaders:
          X-Forwarded-Proto: "https"
        accessControlAllowOriginList:
          - "*"

Hope that helps.

Bonjour :wave:

I’m very sorry, I forgot to answer here.

I found a solution:

Thanks