#multiple cookies per Set-cookie header

1 messages · Page 1 of 1 (latest)

misty walrus
#

Is it possible to set multiple cookies at the same time? When I do await commitSession() with 2 sessions and then merge them into a single string, eg "_session=value1; flash=value2" only the first one gets commited via the Set-cookie header when I redirect, is there a way to set them both?

hazy jungle
#

You can send the same header multiple times, the easiest way is to create a Headers instance and then use headers.append, then do redirect(url, { headers })

misty walrus
#

So it doesn't overwrite the old one @hazy jungle ?

hazy jungle
#

Exactly, if you use a plain JS object you can only have one Set-Cookie key but that’s a limitation of JS not HTTP

misty walrus
#

Ih wow awesome I did not know that, will try out

misty walrus
#

@hazy jungle it actually worked! You are beyond awesome, thank you!

static minnow
#

how can I get the headers I sent from action to a new route frontend component?

severe crypt
#

@static minnow You have your request parameter in your loader, it might contain the headers in request.headers.

static minnow
#

got it so from loader then I need to pass it to the component right?

steel mulch
#

perhaps it does, but i dont think so