Docker Container redirect to

Do you want to: Problem - Docker Container is redirecting to
Document Server version: docker:latest in podman v4.6.1
OS: AlmaLinux9.3
Browser version: Firefox 115.4.0esr

Hello, I have a fresh install of AlmaLinux 9.3 with a NextCloud (latest) installation running on Apache. Nextcloud runs fine. Now I’m struggeling to get OnlyOffice running correctly. OnlyOffice should run as a location behind Apache configured as a reverseProxy.

First I have created all folders and copied the certs:

mkdir -p /opt/onlyoffice/DocumentServer/{data,db,lib,logs}
mkdir -p /opt/onlyoffice/DocumentServer/data/certs
cp /etc/ssl/private/selfsigned.key /opt/onlyoffice/DocumentServer/data/certs/onlyoffice.key
cp /etc/ssl/certs/selfsigned.pem /opt/onlyoffice/DocumentServer/data/certs/onlyoffice.crt
chown -R 100108:100111 /opt/onlyoffice/DocumentServer/data/certs/

Then installing OnlyOffice Container. I’m using a Dockerfile:


RUN sed -i 's/"rejectUnauthorized": true/"rejectUnauthorized": false/' /etc/onlyoffice/documentserver/default.json

…creating a docker image with podman build -t onlyoffice:latest -f Dockerfile. And starting a new Container with:

podman run -i -t -d -p 8888:80 --name=onlyoffice -e JWT_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -e USE_UNAUTHORIZED_STORAGE=true --add-host -v /opt/onlyoffice/DocumentServer/logs:/var/log/onlyoffice:Z -v /opt/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data:Z -v /opt/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice:Z -v /opt/onlyoffice/DocumentServer/db:/var/lib/postgresql:Z -u root onlyoffice:latest

I’ve setted up the apache vHost like suggested in the OnlyOffice documentation:

<VirtualHost *:80>


    RewriteEngine On
    RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=302,L]


<VirtualHost *:443>
    DocumentRoot /var/www/vhosts/


    # SSL Settings
    SSLEngine on

    SSLCertificateFile      /etc/ssl/certs/selfsigned.pem
    SSLCertificateKeyFile   /etc/ssl/private/selfsigned.key

    # enable HTTP/2, if available
    Protocols h2 http/1.1

    CustomLog /var/log/httpd/ combined
    ErrorLog /var/log/httpd/

    <Directory /var/www/vhosts/>
        AllowOverride all
        Options -Indexes
    Header always set Strict-Transport-Security "max-age=63072000"

#### OnlyOffice

Define VPATH /very-long-and-secret-string

<Location ${VPATH}>
  Require all granted
  SetEnvIf Host "^(.*)$" THE_HOST=$1
  RequestHeader setifempty X-Forwarded-Proto http
  RequestHeader setifempty X-Forwarded-Host %{THE_HOST}e
  RequestHeader edit X-Forwarded-Host (.*) $1${VPATH}
  ProxyAddHeaders Off

RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^\${VPATH}/?(.*) "ws://${DS_ADDRESS}/$1" [P,L]
ProxyPass ${VPATH} "http://${DS_ADDRESS}"
ProxyPassReverse ${VPATH} "http://${DS_ADDRESS}"


When I now open I always get redirected to

Just to know: The Server runs not public yet, so I only have edited my local hosts file:

Can anyone Help?

hi @Arny80Hexa :handshake:
At first glance, seem fine.

It’s possible that there might be an issue with DNS settings. I’ll take a closer look a bit later. :face_with_peeking_eye:
If you have any additional details or observations, please share them.

I have already Solved it.

I don’t know if something in this direction changed in the last releases because on a new machine, a few weeks ago, works on this way, like described above.

The Problem is, that when you give the DS some SSL-certs into the mounted /Data/certs dir, the it starts up with ssl enabled. In the nginx-config is a rewrite-rule that redirekts every http-traffic to https://request-url. Since the apache reverse-proxy calls the OnlyOffice-Container with, the nginx in the container redirects always to


Don’t create /opt/onlyoffice/DocumentServer/data/certs/, copy certs in it, and so on.

Way to go (short):

  1. create vHost like suggested in OnlyOffice Documentation
  2. create Dockerfile and build podman image like described above
  3. installingen container
mkdir -p /opt/onlyoffice/DocumentServer/{data,db,lib,logs}

podman run -i -t -d -p --name=onlyoffice -e JWT_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -e USE_UNAUTHORIZED_STORAGE=true --add-host -v /opt/onlyoffice/DocumentServer/logs:/var/log/onlyoffice:Z -v /opt/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data:Z -v /opt/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice:Z -v /opt/onlyoffice/DocumentServer/db:/var/lib/postgresql:Z -u root onlyoffice:latest


1 Like