Skip to content

Commit

Permalink
Adjust changes
Browse files Browse the repository at this point in the history
  • Loading branch information
illiakovalenko committed Jan 10, 2023
1 parent a80557b commit a63730c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,11 @@ describe('MultisiteMiddleware', () => {
validateDebugLog('multisite middleware end: %o', {
rewritePath: '/_site_qsFoo/styleguide',
siteName: 'qsFoo',
headers: {},
headers: {
'x-sc-rewrite': '/_site_qsFoo/styleguide',
},
cookies: {
...res.cookies,
sc_path: '/_site_qsFoo/styleguide',
sc_site: 'qsFoo',
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,8 @@ export class MultisiteMiddleware {
return response;
}

// Site name is forced by query string parameter
let siteName = req.nextUrl.searchParams.get('sc_site');

if (!siteName) {
siteName = this.config.getSite(hostname).name;
}
// Site name can be forced by query string parameter
const siteName = req.nextUrl.searchParams.get('sc_site') || this.config.getSite(hostname).name;

// Rewrite to site specific path
const rewritePath = getSiteRewrite(pathname, {
Expand Down

0 comments on commit a63730c

Please sign in to comment.