Search code examples
asp.net.netasp.net-mvccdnamazon-cloudfront

What is the proper way to enable Cloudfront as a Mirroring CDN for my app hosted in EC2


My asp.net mvc site includes folders for JS and CSS files.

What is the proper way to configure cloudfront to cache these files? Should my origin server name just point to

myapp.com

or

myapp.com/scripts

and

myapp.com/css

I only want to cache the static files, not the whole site of course.


Solution

  • you can point your cdn distribution to your custom origin. If you only want to add /css then point to that. If you want to add more than 1 dir, you should either use a proxy or rerwrite rules.