Skip to content
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

Preview cookies not passed for sequenced redirects #11304

Closed
pex opened this issue Mar 23, 2020 · 3 comments
Closed

Preview cookies not passed for sequenced redirects #11304

pex opened this issue Mar 23, 2020 · 3 comments

Comments

@pex
Copy link
Contributor

pex commented Mar 23, 2020

Bug report

Describe the bug

When redirecting from a third party application to a next app that uses setPreviewData to set preview cookies to then itself redirect to a page that wants to consume preview data in getStaticProps, no cookie will be attached to the request and therefore previewData will be empty.

A common case is a headless CMS that redirects an editor to a preview endpoint in order to review changes.

To Reproduce

Use an affected browser (Safari or Firefox) and

  1. Open private window or clear cookies
  2. Visit https://next-preview-mode-redirect.now.sh/api/redirect
  3. You get redirected to https://next-preview-mode.now.sh/api/preview and setPreviewData
  4. You get redirected to https://next-preview-mode.now.sh/test with no cookie headers set!

Source Code:

  1. Preview Mode App: https://zeit.co/pex/next-preview-mode/7dtqcyof8/source
  2. Simple Redirect App: https://zeit.co/pex/next-preview-mode-redirect/o34d2dx4h/source

Expected behavior

The final page in the redirect chain should always render Preview mode is On when comming from https://next-preview-mode.now.sh/api/preview regardless of the referrer or browser. Therefore the preview cookies always need to be passed in request headers.

Beeing redirect should just work as accessing https://next-preview-mode.now.sh/api/preview directly.

System information

  • OS: macOS, Windows
  • Browsers: Firefox, Safari
  • Version of Next.js: 9.3.1

Additional context

Chrome, Edge and Internet Explorer work as expected.

This issue was extracted from my monologue in #11298.

@timneutkens
Copy link
Member

#11495 potentially solves your issue

@pex
Copy link
Contributor Author

pex commented Mar 31, 2020

It does solve the issue @timneutkens . Many thanks 🙏

@pex pex closed this as completed Mar 31, 2020
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants