aws-amplify / aws-amplify/amplify-hosting

404 redirects appending /index.html

Open
#2,608 2 comments 1 reaction 0 assignees View on GitHub
question 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

_No response_

### Region

_No response_

### Amplify Console feature

_No response_

### Describe the bug

Description of the issue:
Setup:
[suba.domain.com](http://suba.domain.com/) - amplify react application
[subb.domain.com](http://subb.domain.com/) - application hosted on EC2

Replication:
With below 404 redirect rule we are trying to redirect to a resource path/page "test" from suba to subb in case the "test" is not present in [suba.domain.com](http://suba.domain.com/).
404

Source address*: /<\*>
Target address*: [subb.domain.com/](http://subb.domain.com/)<\*>
Type*: 404 redirect
For a "/test" page we are redirected to [subb.domain.com/test/index.html](http://subb.domain.com/test/index.html), however expected behaviour should be "[subb.domain.com/test](http://subb.domain.com/test)"

On using below 301 permanent redirect, the redirections works as expected from [suba.domain.com/test](http://suba.domain.com/test), to [subb.domain.com/test/](http://subb.domain.com/test/),
301

Source address*: /test
Target address*: [subb.domain.com/test](http://subb.domain.com/test)
Type*: 301 permanent redirect

But use-case requirement is to be it working the same for 404 redirects.

### Expected behavior

For a "/test" page we are redirected to [subb.domain.com/test/index.html](http://subb.domain.com/test/index.html), however expected behaviour should be "[subb.domain.com/test](http://subb.domain.com/test)"

### Reproduction steps

Source address*: /<\*>
Target address*: [subb.domain.com/](http://subb.domain.com/)<\*>
Type*: 404 redirect
For a "/test" page we are redirected to [subb.domain.com/test/index.html](http://subb.domain.com/test/index.html), however expected behaviour should be "[subb.domain.com/test](http://subb.domain.com/test)"

### Build Settings

_No response_

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the 404 redirect using the documented Source address /<*> and Target address subb.domain.com/<*> setup, comparing it with the working 301 rule. Done means a request for /test redirects to subb.domain.com/test rather than appending /index.html; the payload names no repository files or tests to inspect.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, react
Domain
cloud, devops
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.