I have an AWS beanstalk application running web-server which generates some static content basing on request parameters. It accepts request urls by following pattern /image.png?w={width}&h={height}&name={name}
. The application is located behind AWS cloudfront, which caches this content for some short period of time. But I want my content to be publicly available by urls like site.com/image/{width}/{height}/{name}.png
. Does AWS cloudfront or other services allow rewriting urls like that?
To redirect a domain in CloudFront, use one of the following: An Amazon Simple Storage Service (Amazon S3) website endpoint that returns a 301 status code. An edge function that redirects requests to the new domain.
Now AWS Cloudfront support AWS Lambda Edge. You can use this lambda function to rewrite the URL of request.
However if you store your static content to AWS S3, then you can also do simple routing configurations
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With