2

I have created an Amazon CloudFront distribution and updated CloudFront URL to pub/static and pub/media URLs to be fetched from CloudFront. JS, CSS and Images are working fine with CloudFront but xhr HTML template files not loading through CloudFront URL. It is showing 403 forbidden in the console but when I open the same URL in browser it works fine. I checked request header and it contains following two headers.

Access-Control-Request-Method: GET
Access-Control-Request-Headers:x-requested-with

I think this is something that is responsible for my problem. Anyone has any suggestions how do I resolve this. I am running my M2 website on Apache server.

Thanks

3
  • I am facing the same issue. Did you found a solution? Feb 8, 2018 at 15:15
  • @MiroslavPetroff Yes, after discussion with CloudFront support team. I jus added the following code in htaccess file. You also may require to allow in the distribution behaviour. Feb 9, 2018 at 12:43
  • Header set Access-Control-Allow-Methods "OPTIONS, GET, HEAD, POST" Header set Access-Control-Allow-Headers "x-test-header, Origin, X-Requested-With, Content-Type, Accept" Feb 9, 2018 at 12:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.