bigcommerce / stencil-cli

BigCommerce Stencil emulator for local theme development
https://developer.bigcommerce.com/stencil-docs
BSD 4-Clause "Original" or "Old" License
102 stars 141 forks source link

fix: Properly add stencil-cli headers to internalapi requests #1164

Closed jmwiese closed 5 months ago

jmwiese commented 5 months ago

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:

Screenshot 2024-02-27 at 8 05 14 AM

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 the stencil-cli header.

After:

Screenshot 2024-02-27 at 9 07 46 AM

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

github-actions[bot] commented 5 months ago

:tada: This PR is included in version 7.3.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket: