Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add `or` operator for Elasticsearch filters in `quickSearchByQuery` and use exists if value is `null` - @cewald (#3960)
- Add unified fetch in mappingFallback for all searched entities - @gibkigonzo (#3942)
- add npm-run-all for parallel build - @gibkigonzo (#3819)
- Add OutputCaching support for x-vs-store-code - @benjick (#3979)

### Fixed
- Fixed Search product fails for category filter when categoryId is string - @adityasharma7 (#3929)
Expand Down
7 changes: 5 additions & 2 deletions core/scripts/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ app.get('*', (req, res, next) => {
next()
}
}

const site = req.headers['x-vs-store-code'] || 'main'
const cacheKey = `page:${site}:${req.url}`

const dynamicRequestHandler = renderer => {
if (!renderer) {
Expand Down Expand Up @@ -207,7 +210,7 @@ app.get('*', (req, res, next) => {
output = ssr.applyAdvancedOutputProcessing(context, output, templatesCache, isProd);
if (config.server.useOutputCache && cache) {
cache.set(
'page:' + req.url,
cacheKey,
{ headers: res.getHeaders(), body: output },
tagsArray
).catch(errorHandler)
Expand Down Expand Up @@ -240,7 +243,7 @@ app.get('*', (req, res, next) => {
const dynamicCacheHandler = () => {
if (config.server.useOutputCache && cache) {
cache.get(
'page:' + req.url
cacheKey
).then(output => {
if (output !== null) {
if (output.headers) {
Expand Down