Update to latest Angular 20 and remove reliance on Host HTTP Header#5276
Open
tdonohue wants to merge 4 commits intoDSpace:mainfrom
Open
Update to latest Angular 20 and remove reliance on Host HTTP Header#5276tdonohue wants to merge 4 commits intoDSpace:mainfrom
Host HTTP Header#5276tdonohue wants to merge 4 commits intoDSpace:mainfrom
Conversation
46baa68 to
49f6c7e
Compare
…tting existing environment.ui.baseUrl. Replace ServerHardRedirectService.getCurrentOrigin() with getBaseUrl() to read this setting.
… UI's hostname. This is now required for SSR to work.
928c091 to
b9d49f6
Compare
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
Description
This PR implements two main changes:
allowedHostssetting to Angular SSR which must specify the list of trusted hostnames.environment.ui.baseUrlsetting has been updated to allow sites to specify the public URL of their site. This value is then used to prepopulate theallowedHostssetting.HostHTTP Header, replacing it with using theenvironment.ui.baseUrl. Because this setting is now required, it's more secure then trusting theHostheader. (Second commit)HostHTTP Header in favor of theenvironment.ui.baseUrlconfiguration)This PR should be backported to
dspace-9_xas it also uses Angular 20.x.Instructions for Reviewers
config.*.ymlto add theui.baseUrl:npm run build:prod && npm run serve:ssrui.baseUrlset to your DSpace's public URL. You should see no errors in the SSR logs and the homepage & Community/Collection/Item pages should respond with Javascript disabled.ui.baseUrlto a different URL (e.g. https://my.dspace.org). This proves that Angular SSR is accurately validating the hostname via theallowedHostsparameter. You will see an error in the SSR logs that says something like this: