Reputation: 49703
Can I implement the following behavior with AWS CloudFront:
https://{id}.example.com/ -> https://{id}.execute-api.us-east-1.amazonaws.com/prod/
I want to make a CloudFront distribution that would simplify the API Gateway domains.
The {id}
part is a placeholder, not a specific ID. I want *.example.com
to match and redirect to https://*.execute-api.us-east-1.amazonaws.com/prod/
but with the *
replaced by the part of the domain that matched.
Upvotes: 1
Views: 934
Reputation: 4461
I assume you want the Origin to be as https://{id}.execute-api.us-east-1.amazonaws.com/prod/ rather then giving new location (302) to Client. In this case, you can use lambda@edge to dynamically choose origin and pass the value you want. Here is an example:
Whitelist the HOST header so you can parse the HOST header in the origin request function and add the parsed value in setting origin.
Upvotes: 1
Reputation: 1
Yes, you can do by putting API gateway url with stage as Origin in CloudFront distribution.
Upvotes: 0