aws-amplify / aws-amplify/amplify-hosting

Path component ignored on 301 redirect to different subdomain

Open
#1,273 3 comments 0 reactions 1 assignee Claimed by @brnmye View on GitHub
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
301 redirects from `https://subdomain.example.com/my-path/` -> `https://www.example.com/new-path/` seem to be ignored.

**To reproduce**
Steps to reproduce the behavior:
1. Connect a custom domain to your app
2. Add a subdomain in 'domain management'
3. Create a 301 redirect from `https://subdomain.example.com/my-path/` to `https://www.example.com/new-path/`
4. Do `curl -I https://subdomain.example.com/my-path/` and find the 301 is not working

**Expected behavior**
A user requesting `https://subdomain.example.com/my-path/` should be redirected to `https://www.example.com/new-path/`.

**Additional information**
Example of 301 redirect with path component:
```
{
"source": "https://subdomain.example.com/my-path/",
"target": "https://www.example.com/new-path/",
"status": "301",
"condition": null
}
```
The above is being ignored and ultimately the request is being processed by this later rule:
```
{
"source": "https://subdomain.example.com",
"target": "https://www.example.com",
"status": "301",
"condition": null
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.