Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS cloudfront url rewrite

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?

like image 493
coquin Avatar asked Mar 23 '16 08:03

coquin


People also ask

How do I redirect a URL in CloudFront?

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.


1 Answers

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

like image 102
Ashan Avatar answered Oct 22 '22 20:10

Ashan