Skip to content

Commit

Permalink
Merge pull request #4453 from Shopify/fd-fix-localization-querystring
Browse files Browse the repository at this point in the history
[Theme] Fix querystring after localization redirect
  • Loading branch information
isaacroldan committed Sep 18, 2024
2 parents e7f0d40 + 09f5c3d commit f6b5256
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/theme/src/cli/utilities/theme-environment/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,12 @@ function patchProxiedResponseHeaders(ctx: DevServerContext, event: H3Event, resp

// Location header might contain the store domain, proxy it:
const locationHeader = response.headers.get('Location')
if (locationHeader) setResponseHeader(event, 'Location', locationHeader.replace(/^https?:\/\/[^/]+/, ''))
if (locationHeader) {
const url = new URL(locationHeader, 'https://shopify.dev')
url.searchParams.delete('_fd')
url.searchParams.delete('pb')
setResponseHeader(event, 'Location', url.href.replace(url.origin, ''))
}

// Cookies are set for the vanity domain, fix it for localhost:
const setCookieHeader =
Expand Down

0 comments on commit f6b5256

Please sign in to comment.