You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I've noticed that previews don't work when used in combination with caching.
Here's an example:
I've got a Node Express server which listens to two endpoints:
example.com/preview - which interprets prismic preview requests
example.com/* - which reads a uid and returns a page.
The second of those two endpoints also emits a cache-control header allowing the browser (and our CDN) to cache the page for 2 hours.
When you activate the preview in prismic the following happens:
browser requests example.com/preview
express server emits a 301 redirect to example.com/some-page
express server serves live version of example.come/some-page
prismic toolbar phones home, gets a preview ref tries to reload the page
expected result: browser reloads the page and user sees draft version. actual result: browser reloads the page from it's local cache not from the server, user still sees the live version.
The CDN isn't an issue here, because it's already varying responses based on the cookie that gets set. It's the browser not making the request that's the problem.
The text was updated successfully, but these errors were encountered:
Hello, I've noticed that previews don't work when used in combination with caching.
Here's an example:
I've got a Node Express server which listens to two endpoints:
example.com/preview - which interprets prismic preview requests
example.com/* - which reads a uid and returns a page.
The second of those two endpoints also emits a cache-control header allowing the browser (and our CDN) to cache the page for 2 hours.
When you activate the preview in prismic the following happens:
actual result: browser reloads the page from it's local cache not from the server, user still sees the live version.
This happens because the method of refreshing here - https://github.com/prismicio/prismic-toolbar/blob/master/src/share.js#L29 - is to just set the window location to effectively be window.location. Really at this point it should call
window.location.reload(true)
.The CDN isn't an issue here, because it's already varying responses based on the cookie that gets set. It's the browser not making the request that's the problem.
The text was updated successfully, but these errors were encountered: