-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the ability to "inject" location into /fides.js
bundles and cache responses for one hour
#3272
Conversation
I definitely didn't realize I had some mixing of fides.js builds from local branches! I think I fixed that now, but CI is still mysteriously cancelling/failing... hmm. |
Passing run #1870 ↗︎
Details:
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is great, and thanks for all of the tests! 🎉
I left a few questions, but those are just to make sure I'm thinking about this the right way 👍
Closes #3170, plus unticketed work to support injecting location 👍
Code Changes
cache-control
headers to the/fides.js
bundle to instruct browsers/CDNs to cache for ~1 hour/fides.js?location=
query param to inject a given location to the bundleCloudFront-Viewer-Country
) to inject a given location to the bundleETag
for caching/fides.js
bundleSteps to Confirm
nox -s "fides_env(test)"
, load the cookie house sample app, and confirm that/fides.js
bundle is cached across page refreshesLoom of some manual cache testing: https://www.loom.com/share/e840916e3c964b00b8d428a07492c9b4
Pre-Merge Checklist
/fides.js
API #3275CHANGELOG.md
Description Of Changes
This adds an (important!) optimization to the
/fides.js
route that will enable HTTP clients/CDNs/etc. to cache the results, so we don't unnecessarily hammer the Privacy Center with requests. This part was fairly easy to do, but I realized while doing this that we should bake in support for generating different bundles for different locations as early as possible- since those cache semantics are kinda hard to reason about...So this PR also proactively adds the ability to request a
fides.js
bundle with an explicit location, e.g.: https://localhost:3000/fides.js?location=US-CA☝️ This will parse the query param out, and add a
location
property to the config object passed into the bundled initialization of Fides.js, ie.window.Fides.init({ consent, location })
This'll should enable us to set up test harnesses to exercise different locations without resorting to a lot of VPN chicanery 😄