Repository navigation
VSB-TUO/send only the public config in the SSR state - #1731
Merged
milanmajchrak merged 3 commits intoNov 17, 2026
Merged
Conversation
The SSR transfer state carried the whole server config, while config.json already had an allowlist. Both now use buildPublicConfig. The allowlist also gets cache.autoSync, which the browser reads, and drops rest.ssrBaseUrl, which it does not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The browser reads it to decide whether to rehydrate the store from the SSR state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain, and the shared allowlist implementation is covered by tests for retained browser settings and excluded server-only fields.
No open issues 🎉
What changed in this PR
Centralizes the browser-facing configuration allowlist for SSR transfer state and generated config.json files, with tests covering public and excluded settings.
Changes:
- Added a shared public configuration builder.
- Updated SSR initialization and config generation to use the allowlist.
- Added tests for browser-required and server-only configuration fields.
| File | Description |
|---|---|
| src/modules/app/server-init.service.ts | Uses the shared public configuration builder when storing application configuration in SSR transfer state. |
| src/config/public-config.ts | Defines the browser-safe configuration projection and its allowed settings. |
| src/config/public-config.spec.ts | Tests that required browser settings are retained and server-only settings are excluded. |
| src/config/config.server.ts | Uses the shared public configuration builder when generating assets/config.json. |
Review effort: Lite
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.
References
config.jsonallowlist.mainin dspace-angular PR 5107: one function feedsconfig.jsonand the SSR state.Description
The SSR state in the HTML of every page carried the whole server config, while
config.jsonalready had an allowlist. Both now come from onebuildPublicConfig().Instructions for Reviewers
src/config/public-config.tsholds the allowlist that was inline inconfig.server.ts.config.server.tswrites it toconfig.json,server-init.service.tsputs it into the SSR state.cache.autoSyncanduniversal.transferState. The browser reads them inserver-sync-buffer.effects.tsandbrowser-init.service.ts. WithoutautoSynca page started fromconfig.jsonreadstimePerMethodofundefined.rest.ssrBaseUrlis dropped. The browser never uses it, and the oldssrBaseUrl: ''/hasSsrBaseUrlscrub goes away with it. Nothing readshasSsrBaseUrl.ui.baseUrlstays out, as inconfig.json. In a Docker deployment it is the Node bind address such ashttp://dspace-angular:4000/, not the public URL, sohasInternalLink()inmetadata-values.component.tsreturns false for real links with or without it.public-config.spec.tsfails on the old allowlist:ssrBaseUrlis there,autoSyncandtransferStateare missing./home. In<script id="dspace-angular-state">theAPP_CONFIG_STATEhasuiwith onlynameSpaceand nocache.serverSide,actuatorsorui.rateLimiter./assets/config.jsonhascache.autoSync./homestate andconfig.jsonhold the same keys (onlyuniversaldiffers), and/homeand/searchload in headless Chrome without JS errors.universal.transferState). Itsui.baseUrlfinding is declined for the reason above.Checklist
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lintnpm run check-circ-deps)package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.🤖 Generated with Claude Code