Skip to content

fix: merge Middleware and API route response cookies #1870

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

Merged
merged 5 commits into from
Jan 9, 2023

Conversation

taty2010
Copy link
Contributor

@taty2010 taty2010 commented Jan 6, 2023

Summary

When adding the Middleware headers to the response we ended up overriding the cookies set by the API route and returning only the cookies set within middleware. This fix ensures that the cookies set within the Middleware and API route are merged, by using 'append' instead of 'set', and that they are in the correct order.

Relevant links (GitHub issues, Notion docs, etc.) or a picture of cute animal

Fixes #1797

Standard checks:

  • Check the Deploy Preview's Demo site for your PR's functionality
  • Add docs when necessary

🧪 Once merged, make sure to update the version if needed and that it was published correctly.

@taty2010 taty2010 requested a review from a team January 6, 2023 20:18
@netlify
Copy link

netlify bot commented Jan 6, 2023

Deploy Preview for netlify-plugin-nextjs-export-demo ready!

Name Link
🔨 Latest commit de4d9cb
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-export-demo/deploys/63bc3d0030f1b90009bf766a
😎 Deploy Preview https://deploy-preview-1870--netlify-plugin-nextjs-export-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jan 6, 2023

Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready!

Name Link
🔨 Latest commit de4d9cb
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-nx-monorepo-demo/deploys/63bc3d005112da000985a9fd
😎 Deploy Preview https://deploy-preview-1870--netlify-plugin-nextjs-nx-monorepo-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@taty2010 taty2010 self-assigned this Jan 6, 2023
@github-actions github-actions bot added the type: bug code to address defects in shipped code label Jan 6, 2023
@netlify
Copy link

netlify bot commented Jan 6, 2023

Deploy Preview for netlify-plugin-nextjs-static-root-demo ready!

Name Link
🔨 Latest commit de4d9cb
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-static-root-demo/deploys/63bc3d0034f0640008c73ded
😎 Deploy Preview https://deploy-preview-1870--netlify-plugin-nextjs-static-root-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jan 6, 2023

Deploy Preview for next-plugin-edge-middleware ready!

Name Link
🔨 Latest commit de4d9cb
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-edge-middleware/deploys/63bc3d005554ad00095ef4f9
😎 Deploy Preview https://deploy-preview-1870--next-plugin-edge-middleware.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jan 6, 2023

Deploy Preview for next-i18next-demo ready!

Name Link
🔨 Latest commit de4d9cb
🔍 Latest deploy log https://app.netlify.com/sites/next-i18next-demo/deploys/63bc3d00118acd0008902d6f
😎 Deploy Preview https://deploy-preview-1870--next-i18next-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jan 6, 2023

Deploy Preview for netlify-plugin-nextjs-next-auth-demo ready!

Name Link
🔨 Latest commit de4d9cb
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-next-auth-demo/deploys/63bc3d00801df60008530f37
😎 Deploy Preview https://deploy-preview-1870--netlify-plugin-nextjs-next-auth-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jan 6, 2023

Deploy Preview for next-plugin-canary failed.

Name Link
🔨 Latest commit de4d9cb
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-canary/deploys/63bc3d009ad63300096857df

@netlify
Copy link

netlify bot commented Jan 6, 2023

Deploy Preview for netlify-plugin-nextjs-demo ready!

Name Link
🔨 Latest commit de4d9cb
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-demo/deploys/63bc3d00e6efa3000845c5c5
😎 Deploy Preview https://deploy-preview-1870--netlify-plugin-nextjs-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Jan 6, 2023

Deploy Preview for nextjs-plugin-custom-routes-demo ready!

Name Link
🔨 Latest commit de4d9cb
🔍 Latest deploy log https://app.netlify.com/sites/nextjs-plugin-custom-routes-demo/deploys/63bc3d00a8e10700090569e7
😎 Deploy Preview https://deploy-preview-1870--nextjs-plugin-custom-routes-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link

@ericapisani ericapisani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small thing, but otherwise looks great!

Co-authored-by: Erica Pisani <[email protected]>
Copy link
Contributor

@ascorbic ascorbic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff!

@MarcL MarcL changed the title Fix: merge Middleware and API route response cookies fix: merge Middleware and API route response cookies Jan 9, 2023
@taty2010 taty2010 requested a review from ericapisani January 9, 2023 15:58
@kodiakhq kodiakhq bot merged commit 878ddd7 into main Jan 9, 2023
@kodiakhq kodiakhq bot deleted the tn/merge-middleware-apiRoute-cookies branch January 9, 2023 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Middleware should merge API route response cookies
3 participants