Details
-
Bug
-
Status: Closed
-
High
-
Resolution: Fixed
-
None
-
None
-
None
-
None
-
0.25
-
Quasar
-
Puma Sprint 246
Description
In CMS-14051 support has been added to read property like Locale and ResponseHeaders from channel configuration instead of from mount configuration. However, it does not result in desired behavior yet.
Requirements
On the brx-saas project on
configure
hst:responseheaders = Access-Control-Allow-Origin: test
After this, request
then the expected result is the response headers 'Access-Control-Allow-Origin: test' from the channel (similar for Locale, linkurlprefix, cdnhost in the PMA response...for which you need look at links, images, etc)
Problem
the problem is typically in code like this:
private Map<String, String> getDefaultResponseHeaders(final HstRequestContext requestContext) { final ResolvedSiteMapItem resolvedSiteMapItem = requestContext.getResolvedSiteMapItem(); if (resolvedSiteMapItem != null) { return resolvedSiteMapItem.getHstSiteMapItem().getResponseHeaders(); } final ResolvedMount resolvedMount = requestContext.getResolvedMount(); if (resolvedMount != null) { return resolvedMount.getResponseHeaders(); } return null; }
the ' resolvedSiteMapItem.getHstSiteMapItem().getResponseHeaders();' returns the headers from the sitemap item, and if there are not headers on the sitemap item, it returns the headers from the mount. However, those are not the headers from the Channel!!
The headers from the channel are only returned when accessed via the flyweight object 'resolvedMount' as follows:
@Override public Map<String, String> getResponseHeaders() { final Channel channel = mount.getChannel(); if (channel != null && channel.getResponseHeaders() != null) { return channel.getResponseHeaders(); } return mount.getResponseHeaders(); }
Solution
In SaaS, it is never needed that on sitemap item level the response headers or locale are overridden...the use case is just not there. So simple remove that part from sitemap items and always use the ResolvedMount to ask the headers for (same for locale)
Attachments
Issue Links
- is a result of
-
CMS-14051 Support new channel properties
- Closed