- Newest
- Most votes
- Most comments
Hello:
If you want to take advantage of CloudFront's edge cache, you will need to create your own distribution to change the settings. You will want to configure your domain as a Regional endpoint instead of an Edge-optimized one.
Regards,
Bob
Hello Bob, thanks for your response.
With the CloudFront distribution managed by API gateway, I have the domain of the API linked automatically with my custom domain.
If I create my own CloudFront distribution, I will have to link the API domain manually in the Cloud Front settings (Origin Domain Name). I am afraid that the API domain name can change after new deployments, breaking the access to it.
Is there a way to eliminate this risk?
Thank you very much.
Regards,
Jean
Hello:
You can still use the custom domain feature in API Gateway to have a static endpoint that will not change no matter how many times you redeploy the underlying API. The key to this configuration is that you must configure the CloudFront distribution to pass through all headers (include the host header) when communicating with the origin. This is how the API Gateway distribution is configured behind the scenes.
Regards,
Bob
Hi Bob,
Thank you. It makes sense, I will try this configuration then.
Just one final question: in this case I will have 2 CloudFront distributions, right?
My custom CloudFront distribution -> (pointing to)
the CloudFront distribution managed by API gateway -> (pointing to)
the API original endpoint.
Regards,
Jean
Jean:
No, as I mentioned in my original post, you'd want to set your domain to a Regional endpoint to remove the second CloudFront distribution.
Regards,
Bob
Relevant content
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago