CDN not working for websites located in subdirectory.

0

Hi,

I'm running a multisite with the following structure

/var/www/example.com/ -> Original Website
/var/www/example.com/en/ ->  Multilanguage website.

And when I apply CloudFront's CDN to the original site, it works perfectly.

However, CloudFront doesn't work for the /en website, which is located in a subdirectory.

I created a new distribution, set it up the same as the original website, and added /en to origin path additionally.

Is there something I'm missing? I'd love to get some advice.

Thank you.

  • Where is Cloudfront pointing to? EC2? S3? Could you provide screenshot of the Distribution?

  • You'll need to provide some additional information to help determine the root cause of the problem. What exactly do you mean by "it doesn't work?" Is there an error message or code? What do you see in your web server access logs?

asked a year ago291 views
1 Answer
1

CloudFront supports the root of the origin that your distribution is directed towards, but it doesn't work for subdirectories.

If you want the CloudFront distribution to reach the subdirectory, then you can use Lambda@Edge (Extra charge).

Here is a blog with more information: https://aws.amazon.com/blogs/compute/implementing-default-directory-indexes-in-amazon-s3-backed-amazon-cloudfront-origins-using-lambdaedge/

AWS
vtjean
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions