aws-amplify / aws-amplify/amplify-hosting

Rewrite and redirect rules don't work for files without extension

Open
#3,622 1 comment 0 reactions 1 assignee Claimed by @Jay2113 View on GitHub
investigating redirects
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

### Before opening, please confirm:

- [X] I have checked to see if my question is addressed in the [FAQ](https://github.com/aws-amplify/amplify-hosting/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-hosting/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-hosting/blob/master/CONTRIBUTING.md).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.

### App Id

d2onlp7qsnn3r1

### AWS Region

us-west-2

### Amplify Hosting feature

Redirects

### Frontend framework

React

### Next.js version

N/A

### Next.js router

N/A

### Describe the bug

Rewrite rules don't work when source URLs point to a file without an extension.

**EXAMPLE**:

*This will not work*

source: /.well-known/apple-developer-merchantid-domain-association
target: /apple-developer-merchantid-domain-association.json
**Error: HTTP 403**

*This will work*

source: /.well-known/apple-developer-merchantid-domain-association.json
target: /apple-developer-merchantid-domain-association.json

### Expected behavior

This should have worked
source: /.well-known/apple-developer-merchantid-domain-association
target: /apple-developer-merchantid-domain-association.json

and content of apple-developer-merchantid-domain-association.json should be served.

### Reproduction steps

In Amplify App Settings:
1. Open "Rewrites and redirects"
2. Add a rule with a source "/.well-known/apple-developer-merchantid-domain-association" and put any existing location in target, for example "/".
3. Open /.well-known/apple-developer-merchantid-domain-association and observe 403 error.

### Build Settings

_No response_

### Log output

```
# Put your logs below this line

```

### Additional information

_No response_

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.