Azure / Azure/static-web-apps

Set-Cookie header not showing when expiry attribute contains an expired date

Open
#1,214 5 comments 3 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
When the managed function returns a response with the "Set-Cookie" header, the set cookie header would not exist if it has an expiry attribute that is set to a past date

```
// won't appear in the response headers
'Set-Cookie': '_test=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Secure'

// will appear in the response headers assuming execution date is before 'Thu, 01 Jan 2024 00:00:00 GMT'
'Set-Cookie': '_test=; Path=/; Expires=Thu, 01 Jan 2024 00:00:00 GMT; Secure'
```

**To Reproduce**
Steps to reproduce the behavior:
1. Create a server-side rendered static web app with the server-side of the app hosted in a managed function
2. On the server-side, when creating a response, use the `Set-Cookie` header and set its value to `_test=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Secure`
3. Make sure your code is deployed into Azure
4. Trigger the route in the deployed app that would give you the response that should contain the `Set-Cookie` header
5. Observe that the header does not exist

**Expected behavior**
`Set-Cookie` should always appear regardless of expiry attribute being expired

**Device info (if applicable):**
- OS: MacOS
- Browser Chrome
- Version 114.0.5735.133 (Official Build) (arm64)

**Additional context**
Works locally, issue only arises when deployed to Azure

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.