Skip to content

Add configurable API suffix#8391

Closed
sneridagh wants to merge 2 commits into
mainfrom
agent/configurable-api-suffix
Closed

Add configurable API suffix#8391
sneridagh wants to merge 2 commits into
mainfrom
agent/configurable-api-suffix

Conversation

@sneridagh

@sneridagh sneridagh commented Jul 21, 2026

Copy link
Copy Markdown
Member

What changed

Adds a configurable API traversal suffix for Volto. This is resolved like we did for @plone/client initialize method, using apiSuffix. In Volto, we go for:

  • Introduces config.settings.apiSuffix, with RAZZLE_API_SUFFIX as its environment-variable counterpart.
  • Centralizes suffix resolution in getApiSuffix() and uses it across API URL formatting, backend URL expansion, authenticated resource requests, and sitemap requests.
  • Keeps existing behavior by default: Volto continues to use /++api++.
  • Gives an explicitly configured apiSuffix precedence over legacyTraverse.
  • Supports an empty suffix (RAZZLE_API_SUFFIX='' or apiSuffix: '') to intentionally omit traversal.
  • Hydrates RAZZLE_API_SUFFIX from window.env so seamless-mode runtime configuration stays consistent between SSR and browser requests.
  • Adds a feature Towncrier entry and documents the new environment variable.

Why

Volto currently chooses only between the fixed /++api++ suffix and no suffix through legacyTraverse.
Deployments that expose the Plone API under another traversal suffix need a supported configuration option without relying on the legacy traversal switch.
Deployments for Plone Nick will also need to setup this to empty string.

Impact

Integrators can configure a nonstandard API traversal suffix through config.settings.apiSuffix or RAZZLE_API_SUFFIX.
The setting overrides legacyTraverse when present, while existing installations retain their current behavior when it is absent.

Validation

  • pnpm --filter @plone/volto test --run src/helpers/Url/Url.test.js src/helpers/Api/Api.plone.rest.test.js src/helpers/Api/PloneBackendAPIResourceWithAuth.test.js
    • 109 tests passed.
  • Prettier check passed for the changed source, type, documentation, and test files.
  • Commit hooks passed, including package lint/format checks and the i18n check.
  • pnpm --filter @plone/volto check:ts still reports existing unrelated typing errors in widget and Storybook files; no errors are associated with this change.

@sneridagh
sneridagh marked this pull request as ready for review July 21, 2026 16:26
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 volto | 🛠️ Build #33691924 | 📁 Comparing 4996123 against latest (7f1c249)

  🔍 Preview build  

2 files changed
± genindex.html
± configuration/environmentvariables.html

Copy link
Copy Markdown
Member Author

Superseded by #8392, which uses the corrected configurable-api-suffix branch name and includes the missing @plone/types Towncrier entry.

@sneridagh sneridagh closed this Jul 22, 2026
@sneridagh
sneridagh deleted the agent/configurable-api-suffix branch July 22, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant