I'm trying to cache a website that is on an EC2, it has an URL uncached.xyz.com
, so i created an Cloud Front with the origin pointed to uncached.xyz.com
and created a record xyz.com
that points to the cloudfront distribution, named something like d111111abcdef8.cloudfront.net
,
But all information returned by the server (like button urls) are not relative and include the request URL, meaning that if Cloudfront access the origin with uncached.xyz.com
, the contents returned by the CDN (for any cname used) will contain the Origin url instead of the url used to access the CloudFront distribution, looking like an <a href="uncached.xyz.com/info"><a>
where it should be <a href="xyz.com/info"><a>
.
tl:dr
CloudFront should return:
<a href="xyz.com/info"><a>
(which is the url accessed that points to the CDN distribution (the cached website))
But it returns:
<a href="uncached.xyz.com/info"><a>
(which is the Origin URL that contains the data to be cached (the website))
Is there a way to "spoof" the Origin server in to thinking that the url being used to access it is the CloudFront distribution instead of the origin URL configured?
Simpler version of what i'm using.