[GH-ISSUE #570] Crashing due to automatic changing authorization method local.json and default.json #265

Closed
opened 2026-02-26 10:31:27 +03:00 by kerem · 7 comments
Owner

Originally created by @SaschaMuehl on GitHub (Jan 23, 2023).
Original GitHub issue: https://github.com/ONLYOFFICE/Docker-DocumentServer/issues/570

Do you want to request a feature or report a bug?
Bug (is also related to #556)

What is the current behavior?
After installation and testing the server sucessfully the jwt token isn't working anymore due to automatic changes (e.g. after restart of the container or the server, after approx. a day) in local.json and default.json.
After new installation or reconfiguration of the Docker-Container the server works well.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

  1. Installing Onlyoffice with JWT enabled in Linux Docker:
    docker run --name=ONLYOFFICEDOCKER -i -t -d -p 4433:443 -e JWT_ENABLED='true' -e JWT_SECRET='mypasswd' --restart=always -v logs:/var/log/onlyoffice -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data onlyoffice/documentserver

  2. Change values in installation i.a.w. https://helpcenter.onlyoffice.com/installation/docs-configure-jwt.aspx

    a. Open the Docker Container :    
    docker exec -it <dockernummer> /bin/sh
    b. set all values in “header” to: “AuthorizationJwt”  (before “Authorization”)    
    nano /etc/onlyoffice/documentserver/local.json
    c. set all value: “rejectUnauthorized” to false:
    nano /etc/onlyoffice/documentserver/default.json
    d. goto https://onlyoffice.xXx.de/ and start test example
    e. supervisorctl restart ds:example

  3. check, if https://onlyoffice.xXx.de/ works

  4. Start Test example

  5. Integrate server adress and JWT password in Nextcloud.

What is the expected behavior?
No automatic changes in local.json and default.json

Host Operating System:
Ubuntu 20.04.5 LTS (GNU/Linux 5.4.0-137-generic x86_64)
nginx version: nginx/1.23.3
PHP 8.1.14 (cli)

How can I tell the container to not change the authorization method?
The system tells me the ds:example is just for testing purposes only but how can I start my own production/environment? (eg. ds:myserver)

Originally created by @SaschaMuehl on GitHub (Jan 23, 2023). Original GitHub issue: https://github.com/ONLYOFFICE/Docker-DocumentServer/issues/570 **Do you want to request a *feature* or report a *bug*?** Bug (is also related to #556) **What is the current behavior?** After installation and testing the server sucessfully the jwt token isn't working anymore due to automatic changes (e.g. after restart of the container or the server, after approx. a day) in **local.json** and **default.json**. After new installation or reconfiguration of the Docker-Container the server works well. **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.** 1. Installing Onlyoffice with JWT enabled in Linux Docker: `docker run --name=ONLYOFFICEDOCKER -i -t -d -p 4433:443 -e JWT_ENABLED='true' -e JWT_SECRET='mypasswd' --restart=always -v logs:/var/log/onlyoffice -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data onlyoffice/documentserver` 2. Change values in installation i.a.w. https://helpcenter.onlyoffice.com/installation/docs-configure-jwt.aspx a. Open the Docker Container :     `docker exec -it <dockernummer> /bin/sh ` b. set all values in “header” to: “AuthorizationJwt”  (before “Authorization”)     `nano /etc/onlyoffice/documentserver/local.json` c. set all value: “rejectUnauthorized” to false: `nano /etc/onlyoffice/documentserver/default.json` d. goto https://onlyoffice.xXx.de/ and start test example e. supervisorctl restart ds:example 3. check, if https://onlyoffice.xXx.de/ works 4. Start Test example 5. Integrate server adress and JWT password in Nextcloud. **What is the expected behavior?** No automatic changes in local.json and default.json **Host Operating System:** Ubuntu 20.04.5 LTS (GNU/Linux 5.4.0-137-generic x86_64) nginx version: nginx/1.23.3 PHP 8.1.14 (cli) **How can I tell the container to not change the authorization method? The system tells me the ds:example is just for testing purposes only but how can I start my own production/environment? (eg. ds:myserver)**
kerem 2026-02-26 10:31:27 +03:00
  • closed this issue
  • added the
    wontfix
    label
Author
Owner

@SaschaMuehl commented on GitHub (Mar 14, 2023):

The problem still exists. Any suggestions?

<!-- gh-comment-id:1467624182 --> @SaschaMuehl commented on GitHub (Mar 14, 2023): The problem still exists. Any suggestions?
Author
Owner

@weasam commented on GitHub (Jul 20, 2023):

I'm using this for docker
docker run -i -t -d -p 8082:80 --restart=always -e JWT_SECRET=<my_secret_phrase> onlyoffice/documentserver

My situation is every time the docker restart it change my custom setting "AuthorizationJwt" back to "Authorization"
nano /etc/onlyoffice/documentserver/default.json
"Authorization" change to "AuthorizationJwt" both inbox & outbox line
This fixed my case when restart the docker without change /etc/onlyoffice/documentserver/local.json

In addiction, Another solution might be like this
docker run -i -t -d -p 127.0.0.1:8478:80 --restart=always
-e JWT_ENABLED=true
-e JWT_SECRET=<my_secret_phrase>
-e JWT_HEADER=AuthorizationJwt
-e JWT_IN_BODY=true
-v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data onlyoffice/documentserver

<!-- gh-comment-id:1643450895 --> @weasam commented on GitHub (Jul 20, 2023): I'm using this for docker docker run -i -t -d -p 8082:80 --restart=always -e JWT_SECRET=<my_secret_phrase> onlyoffice/documentserver My situation is every time the docker restart it change my custom setting "AuthorizationJwt" back to "Authorization" nano /etc/onlyoffice/documentserver/default.json "Authorization" change to "AuthorizationJwt" both inbox & outbox line This fixed my case when restart the docker without change /etc/onlyoffice/documentserver/local.json ------------------------------------------------------------------------------------------------------------------------------------ In addiction, Another solution might be like this docker run -i -t -d -p 127.0.0.1:8478:80 --restart=always \ -e JWT_ENABLED=true \ -e JWT_SECRET=<my_secret_phrase> \ -e JWT_HEADER=AuthorizationJwt \ -e JWT_IN_BODY=true \ -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data onlyoffice/documentserver
Author
Owner

@SaschaMuehl commented on GitHub (Jul 20, 2023):

I'm using this for docker docker run -i -t -d -p 8082:80 --restart=always -e JWT_SECRET=<my_secret_phrase> onlyoffice/documentserver

My situation is every time the docker restart it change my custom setting "AuthorizationJwt" back to "Authorization"

nano /etc/onlyoffice/documentserver/default.json
"Authorization" change to "AuthorizationJwt" both inbox & outbox line
This fixed my case when restart the docker without change /etc/onlyoffice/documentserver/local.json
In addiction, Another solution might be like this docker run -i -t -d -p 127.0.0.1:8478:80 --restart=always -e JWT_ENABLED=true -e JWT_SECRET=<my_secret_phrase> -e JWT_HEADER=AuthorizationJwt -e JWT_IN_BODY=true -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data onlyoffice/documentserver

100% Same Problem

<!-- gh-comment-id:1643998602 --> @SaschaMuehl commented on GitHub (Jul 20, 2023): > I'm using this for docker docker run -i -t -d -p 8082:80 --restart=always -e JWT_SECRET=<my_secret_phrase> onlyoffice/documentserver > > ## My situation is every time the docker restart it change my custom setting "AuthorizationJwt" back to "Authorization" > nano /etc/onlyoffice/documentserver/default.json > "Authorization" change to "AuthorizationJwt" both inbox & outbox line > This fixed my case when restart the docker without change /etc/onlyoffice/documentserver/local.json > In addiction, Another solution might be like this docker run -i -t -d -p 127.0.0.1:8478:80 --restart=always -e JWT_ENABLED=true -e JWT_SECRET=<my_secret_phrase> -e JWT_HEADER=AuthorizationJwt -e JWT_IN_BODY=true -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data onlyoffice/documentserver 100% Same Problem
Author
Owner

@wabadoo-wabadee commented on GitHub (Nov 5, 2024):

same problem for me. secret in local.json changes on every startup. This is now almost 2 years old, any motivation to fix such an fundamental issue?

<!-- gh-comment-id:2456627742 --> @wabadoo-wabadee commented on GitHub (Nov 5, 2024): same problem for me. secret in local.json changes on every startup. This is now almost 2 years old, any motivation to fix such an fundamental issue?
Author
Owner

@igwyd commented on GitHub (Nov 6, 2024):

Hello, sorry for the late reply. This is the correct behavior, docker variables work this way. If you need to change the jwt header or jwt secret, you will have to stop the old container and run a new one with the new data JWT_SECRET=new-secret and JWT_HEADER=new-header. Because every time you restart the container, the variables you started with will be checked and applied.

<!-- gh-comment-id:2459851888 --> @igwyd commented on GitHub (Nov 6, 2024): Hello, sorry for the late reply. This is the correct behavior, [docker variables](https://github.com/ONLYOFFICE/Docker-DocumentServer?tab=readme-ov-file#available-configuration-parameters) work this way. If you need to change the jwt header or jwt secret, you will have to stop the old container and run a new one with the new data ```JWT_SECRET=new-secret``` and ```JWT_HEADER=new-header```. Because every time you restart the container, the variables you started with will be checked and applied.
Author
Owner

@Rita-Bubnova commented on GitHub (Nov 7, 2024):

I close this issue. Feel free to comment or reopen it if you got further questions.

<!-- gh-comment-id:2461563533 --> @Rita-Bubnova commented on GitHub (Nov 7, 2024): I close this issue. Feel free to comment or reopen it if you got further questions.
Author
Owner

@wabadoo-wabadee commented on GitHub (Nov 7, 2024):

Hello, sorry for the late reply. This is the correct behavior, docker variables work this way. If you need to change the jwt header or jwt secret, you will have to stop the old container and run a new one with the new data JWT_SECRET=new-secret and JWT_HEADER=new-header. Because every time you restart the container, the variables you started with will be checked and applied.

Thank you very much! The last part was the info I missed.

So for anybody coming here via google who wants to set a persistent jwt secret ("secret key" in nextcloud), here's how it's done (using docker-compose):

  1. start you documentserver container

  2. get the (randomized) secret via
    docker exec onlyoffice-documentserver sudo documentserver-jwt-status.sh

  3. save the secret in your environment variable / docker-compose / ...
    example for docker-compose.yml:

environment:
[...]
# Uncomment strings below to enable the JSON Web Token validation.
- JWT_ENABLED=true
- JWT_SECRET=<YOUR_SECRET_HERE>
- JWT_HEADER=Authorization
#- JWT_IN_BODY=true
[...]

  1. restart the container with the variable set
    docker exec onlyoffice-documentserver documentserver-prepare4shutdown.sh; docker-compose down; docker-compose up -d
<!-- gh-comment-id:2461958635 --> @wabadoo-wabadee commented on GitHub (Nov 7, 2024): > Hello, sorry for the late reply. This is the correct behavior, [docker variables](https://github.com/ONLYOFFICE/Docker-DocumentServer?tab=readme-ov-file#available-configuration-parameters) work this way. If you need to change the jwt header or jwt secret, you will have to stop the old container and run a new one with the new data `JWT_SECRET=new-secret` and `JWT_HEADER=new-header`. Because every time you restart the container, the variables you started with will be checked and applied. Thank you very much! The last part was the info I missed. So for anybody coming here via google who wants to set a persistent jwt secret ("secret key" in nextcloud), here's how it's done (using docker-compose): 1. start you documentserver container 2. get the (randomized) secret via `docker exec onlyoffice-documentserver sudo documentserver-jwt-status.sh` 3. save the secret in your environment variable / docker-compose / ... example for docker-compose.yml: > > environment: >[...] > # Uncomment strings below to enable the JSON Web Token validation. > - JWT_ENABLED=true > - JWT_SECRET=<YOUR_SECRET_HERE> > - JWT_HEADER=Authorization > #- JWT_IN_BODY=true >[...] > 4. restart the container with the variable set `docker exec onlyoffice-documentserver documentserver-prepare4shutdown.sh; docker-compose down; docker-compose up -d`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Docker-DocumentServer-ONLYOFFICE#265
No description provided.