fix: Properly add stencil-cli headers to internalapi requests #1164
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?
Correctly add headers indicating this is a stencil cli request to /internalapi routes. This allows us, among other things, to properly set cookies in the browser from checkout when running on localhost.
Screenshots (if appropriate)
Before:
We can see cookies are incorrectly coming back with
SameSite=None
which isnt allowed here, so the cookies fail to persist in the browser and no login occurs. We can see internally that the incoming request in this case doesnt have thestencil-cli
header.After:
We can see that due to now propagating the header the cookies correctly have empty
SameSite
attribute and persist to the browser allowing login.cc @bigcommerce/storefront-team