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

  • I am facing the same issue. Did you found a solution? – Miroslav Petroff Feb 8 '18 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. – Gulshan Maurya Feb 9 '18 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" – Gulshan Maurya Feb 9 '18 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.