1

I have two different Vue.JS apps deployed to AWS S3 + Cloudfront. The first has the domain set up in Route53, while the second has the domain set up in Google's domain service.

Both of the apps works completely fine. Recently I tried using the cloudfront predefined security headers under the "behavior" settings:

enter image description here

The header policy has all of the following:

enter image description here

The first app (with the domain configured in Route53) continues to work perfectly fine, but for the second app I started getting CORS issues.

enter image description here

This boggles the mind a little bit, because I'm getting CORS errors from within the same domain.

enter image description here

4
  • I think it's complaining about your scripts not having the right MIME type (expects application/javascript). Does this help? stackoverflow.com/a/67928269 Mar 8, 2022 at 21:20
  • 1
    @LouisWaweru - This is a Vue.JS single page application with no manually linked js files - the whole thing compiles into an index.html file and a bunch of js and css files when it's built, all handled by the vue CLI. Inspecting the index.html file shows that the generated script files are added with: <script src="/js/app.ecba88eb.js"></script>. Just to be sure, I manually added type="application/javascript" and updated S3 and invalidated the cloudfront cache, but I'm still getting the same result.
    – Carel
    Mar 8, 2022 at 21:41
  • @LouisWaweru - wait, I only read your message before and somehow missed the link you provided. There is hope, I am attempting this now.
    – Carel
    Mar 8, 2022 at 21:45
  • 1
    @LouisWaweru yes that's it, it works, unbelievable
    – Carel
    Mar 8, 2022 at 21:50

1 Answer 1

2

I think it's complaining about your scripts not having the right MIME type (expects application/javascript). Does this help?

manually change the system-defined content-type in the S3 console for the individual js objects from text/plain to application/javascript, then make sure the cache was invalidated and refreshed

source: schquestionasker

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .