Azure / Azure/static-web-apps

Redirect configuration doesn't work

Open
#1,212 3 comments 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

I'm configuring a route in order to redirect from "/directus" to "/directus/", and the SWA only ever 404's

Configuration

```json
{
"routes": [
{
"route": "/*.{css,js,png,jpeg,jpg,webp,svg,ico,json}",
"headers": {
"Cache-Control": "public, max-age=31536000, immutable"
}
},
{
"route": "/directus",
"redirect": "/directus/",
"statusCode": 301
},
{
"route": "/directus/index.html",
"redirect": "/directus/",
"statusCode": 301
},
{
"route": "/directus.html",
"redirect": "/directus/",
"statusCode": 301
}
],
"responseOverrides": {
"404": {
"rewrite": "/404.html"
}
},
"forwardingGateway": {
"allowedForwardedHosts": [
"someloantest-cffffeweqqq.z01.azurefd.net"
]
}
}
```

A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Update staticwebapp.config.json with a route to redirect from /directus to /directus/
2. Execute curl -X GET -I https://{your-app}.azurestaticapps.net/directus
3. See 'http/2 404' response type

**Expected behavior**
Should be a 301 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.