aws-amplify / aws-amplify/amplify-hosting

Multiple Locale 404 Redirects with a SSG application

Open
#2,748 1 comment 0 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-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.

### App Id

d1t607ieuzysuf

### Region

_No response_

### Amplify Hosting feature

Redirects

### Describe the bug

I have a deployed SSG NextJS application with multiple generated Locales. I couldn't see in the documentation, nor any form validation in the redirects tool against having multiple 404 routes, or a 404 route that isn't on the base path.

My requirement is to have the following:
1. `/fr-CA/<*>` => `/fr-CA/404/` `404-200` (this doesn't work)
2. `/<*>` => `/404/` `404-200` (this works)

No matter what, any link beginning with `/fr-CA/` will still redirect to `/404/`.

I have also tested `/<*>` => `/fr-CA/404/` and that worked, so the route is functional. I have also tested with and without trailing slashes as well as adding the `.html` extension.

### Expected behavior

The expected behaviour would be:

`domain.com/fr-CA/sometranslated404url` redirects to `domain.com/fr-CA/404/`
`domain.com/some404url` redirects to `domain.com/404/`

### Reproduction steps

1. Deploy a simple app with multiple nested routes
2. Apply redirect 404 rules against a nested route

Screenshot 2022-05-11 at 14 22 45

### Build Settings

_No response_

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start in the Amplify Hosting Redirects feature and reproduce the reported behavior with the provided app ID, using a deployed SSG Next.js application with both locale-specific and base-path 404 rules. Compare the `/fr-CA/<*>` and `/<*>` cases, including the tested trailing-slash and `.html` variants. Done means determining whether nested locale 404 redirects can coexist and documenting or fixing the behavior accordingly.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, next.js
Domain
cloud
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.