Redirect some URL requests to CloudFront and the rest direct to the normal server?
Posted
by
indiehacker
on Server Fault
See other posts from Server Fault
or by indiehacker
Published on 2012-05-30T20:35:08Z
Indexed on
2012/05/30
22:42 UTC
Read the original article
Hit count: 309
amazon-cloudfront
Say I have two types of URL requests that must be handled by my REST API:
http://query.restapi.com/image.png?apikey=abc123
http://query.restapi.com/2.0/<apiKey>/resource.json?from=umi.us_census00.state_geometry
Is it possible to redirect only some URL requests for static images (ie., regex: *.png?.*
) to take advantage of CloudFront's caching and have the rest of the requests go directly to the normal EC2 server (or at least take a speedier indirect route to the normal EC2 server?).
Perhaps the added request time for the misses to CloudFront is irrelevant to worry about?
Or perhaps my situation is not best to use for CloudFront?
I understand I will need to make DNS change where the current URL requests having http://query.restapi.com/some.png?apikey=0123
get redirected to http://d1234.cloudfront.net/some.png
, but I am hoping there is some way for just redirecting static .png requests to take advantage of CloudFront?
© Server Fault or respective owner