https://github.com/githubnext/azureswacookies
https://github.com/githubnext/azureswacookies
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/githubnext/azureswacookies
- Owner: githubnext
- Created: 2024-08-05T18:10:56.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-25T16:09:07.000Z (about 1 year ago)
- Last Synced: 2025-04-12T01:06:08.915Z (10 months ago)
- Language: TypeScript
- Size: 791 KB
- Stars: 3
- Watchers: 0
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This repo is a minimal reproduction of the issue where Azure Static Webapps strips out cookies that are set.
It's probably related to this issue: https://github.com/Azure/static-web-apps/issues/760
To run locally: `pnpm install` and then `pnpm dev`
I've set this up to deploy to Azure SWA and you can see the difference between requests made to the local devserver and Azure SWA:

Notice that in production, the `set-cookie` header is not included even though the `arr-disable-session-affinity` header is correctly passed through. Both are set in the same file. You can see in [src/hooks.server.ts](./src/hooks.server.ts):
```ts
export const handle: Handle = async ({ event, resolve }) => {
event.setHeaders({ 'Arr-Disable-Session-Affinity': 'true' });
event.cookies.set('testcookie', 'testcookie', {
path: '/',
maxAge: 31536000000,
sameSite: "lax",
httpOnly: false,
});
return await resolve(event);
};