I’m trying to cache a website on an EC2 using the URL xyz.com, so i created an Cloud Front with the origin pointed to xyz.com,
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 xyz.com, the contents returned by the CDN (for any cname used) will contain the origin url like an <a href="xyz.com/info"><a>
instead of a “cached” url that points to the CloudFront distribution, like an cdn.xyz.com.
tl:dr
CloudFront should return:<a href="cached.xyz.com/info"><a>
(which is the url accessed that points to the distribution)
But it returns:<a href="uncached.xyz.com/info"><a>
(which is the Origin URL that contains the data to be cached)
Is there a way to spoof the Origin server to it think that URL that is being used to access it is the URL being used to access the CloudFront distribution, so it returns correct URLs?