Community edition Docker for Docs opening wrong file

Ask a how-to question

I have set up a document server in a docker locally. I have the following HTML file:

<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
    <div id="placeholder"></div>
    <script type="text/javascript" src="http://localhost:80/web-apps/apps/api/documents/api.js"></script>
    <!-- Ensure your JS file is included after the OnlyOffice API script -->
    <script type="module" src="docEditor.js"></script>
</body>
</html>

where docEditor.js contains:

const config = {
        "document": {
            "fileType": extension,
            "key": "Khirz6zTPdfd7",
            "title": docName,
            "url": url
        },
        "documentType": "word",
        "editorConfig": {
            "callbackUrl": "http://host.docker.internal:8000/track"
        }
    };
config.token = token;
var docEditor = new DocsAPI.DocEditor("placeholder", config);

where url is a signed url from google cloud storage.

My issue:

  1. I start a docker image
  2. I open file A. File A opens in docEditor
  3. I close file A.
  4. I open file B, but file A opens instead.
  5. This continues. Until I restart docker, the same file A opens no matter what url I send.

I triple checked that I send correct urls for the documents I am trying to open.

I assume some caching is happening somewhere. I have caching disabled in my browser. I can’t get to the bottom of it.

Hello, probably it is because you provide the same key in Editor’s initialization config (Config - ONLYOFFICE Api Documentation) for different documents, each document should have unique key

1 Like

This was exactly it! I somehow totally overlooked it! Thank you!

1 Like