fix(storefront): strf-10118 Fix redirects stalling locally #1000
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.
What?
Fix redirects not working locally. Currently, any redirects happening within Stencil CLI will hang, and the redirect will never finish. This can be seen by creating a redirect and attempting to browse to the redirect in Stencil CLI, or by simply attempting to browse to a product without the trailing slash.
Why?
We should expect redirects to demonstrate the same behavior that one would see in the production environment of BigCommerce.
This issue was occurring because our
RedirectsResponse.respond
method was not stripping the'content-length'
header, causing the redirected response to be treated as a stream that would never resolve.Tickets / Documentation
Video proof of fix
Before:
Screen.Recording.2022-10-10.at.4.08.18.PM.mov
After:
Screen.Recording.2022-10-10.at.4.10.14.PM.mov
cc @bigcommerce/storefront-team