aws-amplify / aws-amplify/amplify-hosting

Amplify Hosting - Rewrites and redirects - header based redirects

Open
#3,864 3 comments 3 reactions 1 assignee Claimed by @josefaidt View on GitHub
feature-request
Dominant language
Dockerfile
Stars
481
Forks
123
PR merge metrics
No merged PRs in 30d

Description

### Is this feature request related to a new or existing Amplify category?

hosting

### Is this related to another service?

Hosting

### Describe the feature you'd like to request

Ability to rewrite or redirect based on the headers in the http request.

(currently this is possible with lambda@edge on Cloudfront, but not via amplify hosting)

### Describe the solution you'd like

Screenshot 2023-12-18 at 10 49 43 PM

I would like to have two options..."Add URL Rule" and "Add Header Rule"...

URL Rule would behave like the current rule

Header Rule would have the following fields:
Header Field (ie User-Agent)
Header Values (an array of values, or a regexp that will run the redirect if Header Field is matches)
Target Address (where we will redirect to...with wildcards or whatever)
Type (200, 30X, 40X)
Order

Alternately a way to just redirect to a lambda would be also helpful.

### Describe alternatives you've considered

Switching to use Cloudfront seems like a big effort, and loses a bunch of functionality

### Additional context

This will allow for handling social media link cards for Facebook/X when using Single Page Apps...lots of other use cases...

### Is this something that you'd be interested in working on?

- [ ] 👋 I may be able to implement this feature request

### Would this feature include a breaking change?

- [ ] ⚠️ This feature might incur a breaking change

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.