aws-amplify / aws-amplify/amplify-hosting
Supports both Hugo URLs and SPA URLs
- Dominant language
- Dockerfile
- Stars
- 481
- Forks
- 123
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
I have an Amplify project that uses both Hugo and React as an SPA.
Under /blog... the Hugo file are served and the rest is handled by the React SPA.
Today the hosting is S3andCloudfront deployed by Amplify CLI and all URL works well (with trainling slahes too):
```
https://mydomain.com/blog -> return the file /blog/index.html
https://mydomain.com/blog/ -> return the file /blog/index.html
https://mydomain.com/blog/article1 -> return the file /blog/article1/index.html
https://mydomain.com/blog/article1/ -> return the file /blog/article1/index.html
https://mydomain.com -> return my SPA file /index.html
https://mydomain.com/other-spa-route -> return my SPA file /index.html (and then React use the router to display the appropriate page)
```
Following the instruction from [the doc](https://docs.aws.amazon.com/amplify/latest/userguide/redirects.html), I try to do the same but fail.
The default behavior of Amplify Console hosting is perfect for the Hugo blog part (section _Trailing slashes and Clean URLs_)
The section _Redirects for Single Page Web Apps (SPA)_ is perfect for my React app.
**But I can't have both!**
If I set the SPA rule in place it catches all URLs for the blog and break the blog URLs (with trailing slashes).
I am talking about this rule: ``
**Describe the solution you'd like**
I like to have a SPA redirect rules that ignore a prefix. Like not catching urls under /blog... to let the default behavior applies.
**Additional context**
I tried playing with Regex but with no success. If Regex is possible please add that in the documentation.
Contributor guide
Research direction
Start with the linked Amplify redirects documentation, particularly “Trailing slashes and Clean URLs” and “Redirects for Single Page Web Apps (SPA),” then examine the reported SPA rule. No source files or tests are named; done means the React SPA fallback works while /blog and its trailing-slash Hugo URLs retain their existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, react
- Domain
- cloud, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100