Azure / Azure/static-web-apps

Headers are not included when adding a redirect

Open
#739 1 comment 0 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**
We'd like to set a `Strict-Transport-Security` header for all responses. This works fine by adding it in `globalHeaders` except for routes that include a redirect, for those routes the headers are not included.

Adding the headers to the route specifically does not work either.

**To Reproduce**
Just create a static web app with the following config:
```json
{
"routes": [
{
"route": "/redirect",
"redirect": "https://example.com",
"statusCode": 302
}
],
"globalHeaders": {
"Strict-Transport-Security": "max-age=63072000; includeSubDomains; preload"
}
}
```

Try issuing a GET request for `/redirect`. Notice how the `Strict-Transport-Security` header is not included in the response.

**Expected behavior**
I would expect all headers in `globalHeaders` as well as those in the header block for the route to be included even when issuing a redirect.

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.