aws-amplify / aws-amplify/amplify-hosting

Files without extension fails rewrite rule

Open
#1,927 3 comments 2 reactions 0 assignees View on GitHub
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-console/blob/master/FAQ.md).
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-console/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-console/blob/master/CONTRIBUTING.md).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

### App Id

d2opkaw49cobwu

### Region

ap-south-1

### Amplify Console feature

Redirects

### Describe the bug

I have a articles folder in my public folder of react app. It has 100 blog files. The content of file is html.
However the file names do not contain `html` extension.

`/articles/blog-path` is served from inside my react app as a fallback.
to server raw file from `public/articles` directory I added a rewrite rule to take precedence over react app path.

```
{
"source": "/articles/<*>",
"target": "/articles/<*>",
"status": "200",
"condition": null
},
```

it loads index.html correctly, however any blog such as

`/articles/my-blog-1` is not loaded.

### Expected behavior

url should load file even with no extension

### Reproduction steps

create articles directory in public folder of a react app.
add files to it without extension.
try to create a redirect/rewrite rule to serve the file.

### Build Settings

```yaml
default build react app file from aws amplify was chosen.
```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the deployment with a React app's public/articles directory, extensionless HTML files, and the shown /articles/<*> rewrite rule; compare index.html with /articles/my-blog-1. The issue names no source file or test, so trace Amplify Hosting's redirect and rewrite handling and verify that an extensionless file is served directly without the React fallback.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, react
Domain
cloud, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.