Repository navigation
fix(example): fetch callback links from the internal address - #22
Merged
Merged
Conversation
The document server builds the links in a callback from the address the browser used. With the documented "-p 8080:80" that port only exists on the docker host, so the example could not download the saved file: the callback failed with ECONNREFUSED, the changes went to the forgotten folder and every later open warned that the file came from a server backup copy. server.internalSiteUrl now names the address this backend reaches the document server on, and the url, changesurl and formsdataurl of a callback are fetched from it. It is http://localhost/ in production-linux.json, where the example runs next to nginx. The orchestrated example loads the same file from its own container, where localhost is not the document server, so docker-entrypoint.sh overrides it from DS_INTERNAL_URL. Left unset, links are fetched as they are, as before. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Hendrik Leidinger <hendrik.leidinger@nextcloud.com>
A proxy on a subpath puts its prefix in front of /cache/files in the links the document server builds. That path only exists on the public address, so fetching it from internalSiteUrl returned 404 and the changes went to the forgotten folder. Start the path at /cache/files when fetching it internally. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Hendrik Leidinger <hendrik.leidinger@nextcloud.com>
Contributor
Testing status: positive check, passesScenario tested
Observations
Limits
|
Contributor
|
Also tested in image form. Details - |
29 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With the documented
-p 8080:80andEXAMPLE_ENABLED=true, edits made in the example are never saved to storage.The document server builds callback links from the address the browser used (
http://localhost:8080/cache/files/...). The example runs inside the same container, where nothing listens on 8080, so the download fails withECONNREFUSED. The server then stores the changes as forgotten, and every later open shows:Fix
server.internalSiteUrlsetting: the address this backend uses to reach the document server.nullindefault.json, so nothing is rewritten unless it is set.url,changesurlandformsdataurlfrom a callback are fetched from that address. A proxy prefix in front of/cache/filesis dropped, because that path only exists on the public address. All three are needed: fixing onlyurlwould still fail on thechangesurldownload.production-linux.jsonsetshttp://localhost/, because the example runs next to nginx.production-linux.json, but runs in its own container, wherelocalhostis not the document server.docker-entrypoint.shtherefore overrides the setting from the new optionalDS_INTERNAL_URL. When unset it is empty and links are fetched unchanged, as they are today.Testing
Each case typed text in a real editor, closed it, then checked the stored file and reopened it.
-p 8092:80, stock example (baseline)DS_INTERNAL_URLunsetDS_INTERNAL_URL=http://ds/DS_INTERNAL_URL=http://localhost/(negative control, first run only)localhostThe negative control shows why
production-linux.jsonalone would have broken orchestrated deployments.diff.zipwas also written to the version history in the standalone run.eslintpasses onapp.js.Limits of this testing:
siteUrlset to/office/. With the standalone default/, the editor does not load under a subpath at all, with or without this PR.documentserver-build-cache:pr-508image, not from a rebuilt image.docker-entrypoint.shandproduction-linuxconfig, not the actualcluster-exampleimage.formsdataurlgo through the same helper but were not exercised.Things to review
production-linux.json. If nginx there is moved off port 80,http://localhost/would be wrong, so saves would needinternalSiteUrlset inlocal.json. I have not tested package installs.DocumentServerneeds a submodule bump for this to reach the images.🤖 Generated with Claude Code