aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
461 stars 116 forks source link

Amplify Hosting - Rewrites and redirects - header based redirects #3864

Open georgevicbell opened 11 months ago

georgevicbell commented 11 months ago

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?

Would this feature include a breaking change?

ykethan commented 11 months ago

Hey, 👋 thanks for raising this! I'm going to transfer this over to our hosting repository for better assistance 🙂.

github-actions[bot] commented 11 months ago

This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!