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

Only one cookie is being set when you have multiple Set-Cookie #131

Closed
silentworks opened this issue Nov 13, 2023 · 3 comments
Closed

Only one cookie is being set when you have multiple Set-Cookie #131

silentworks opened this issue Nov 13, 2023 · 3 comments

Comments

@silentworks
Copy link

silentworks commented Nov 13, 2023

Describe the bug
When using Netlify build we are only getting one cookie set when we have multiple Set-Cookie in the header. This is inconsistent with how the Remix dev server works and how the MDN docs say it should work.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new remix app using the netlify template npx create-remix@latest --template netlify/remix-template
  2. Edit the app/root.tsx file and add the following
import type { MetaFunction } from "@remix-run/node";
import {
  Links,
  LiveReload,
  Meta,
  Outlet,
  Scripts,
  ScrollRestoration,
} from "@remix-run/react";
import { json } from '@remix-run/node';

export const meta: MetaFunction = () => [{
  charset: "utf-8",
  title: "New Remix App",
  viewport: "width=device-width,initial-scale=1",
}];

export const loader = async () => {
  const ckHeaders = new Headers([
    ["Set-Cookie", "lulu=meow; Max-Age=3600; Path=/; SameSite=Lax"],
    ["Set-Cookie", "booya=kasha; Max-Age=3600; Path=/; SameSite=Lax"],
  ]);

  return json(
    {},
    {
      headers: ckHeaders,
    }
  );
};

export default function App() {
  return (
    <html lang="en">
      <head>
        <Meta />
        <Links />
      </head>
      <body>
        <Outlet />
        <ScrollRestoration />
        <Scripts />
        <LiveReload />
      </body>
    </html>
  );
}
  1. Run the build and start the netlify server using npm run build && npm start
  2. When the browser opens check your cookie storage and you will notice only the second cookie was saved.

Expected behavior
Both cookies should be saved and not only the second one.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: MacOS
  • Browser Firefox
  • Version 2.2.0

Additional context
Add any other context about the problem here.

@ascorbic
Copy link
Contributor

Thanks for the report. We've identified this as a bug in our new functions runtime so will prioritise a fix.

@ascorbic
Copy link
Contributor

We have a fix ready. I'll update this ticket when it's rolled out

@silentworks
Copy link
Author

Thank you so much for this @ascorbic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants