I have a Cloud Front distribution that servers files from '/pub/static' folder of Magento.

This distribution has that configurations above:

enter image description here

enter image description here

enter image description here

But some files are broken because it's not on cloud front.

What I'm doing wrong?

  • Can you show error from browser console? – BartZalas Feb 13 '20 at 18:27
  • Hi @BartZalas I can't. But the error always appears after a deploy to production, because Magento append path version change to url. – Diego Queiroz Feb 13 '20 at 18:35
  • Yes but cloudfront will download new version. Maybe your error is with cors policy? Without part error is difficult to help. Even your path with pub/static could be an issue. – BartZalas Feb 13 '20 at 18:46
  • @BartZalas, there's no error in dev console....just a 404 not found page. – Diego Queiroz Feb 13 '20 at 19:38

Origin path in Origin Settings

leave it empty (this is reason why you get error)

Default/root/object in Distribution Settings set to your path pub/static (or static)

Allowed http methods set to GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE

After this changes , wait a little. You should load static files now or see 502 error (this mean you are on good road)


I just found this, really helped me:


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.