I am adding ActionText / Trix into existing Rails 6 app without Webpacker.
Everything is working fine in dev through importmap-rails gem.
In production, assets are served from s3/cloudfront bucket. All of the other assets are being fetched without any issues as before.
New application.js
is blocked though and console is warning:
Access to script at 'https://dildaikntvx6.cloudfront.net/cd/assets/application-110db9dec93064a75e0f73152b58569feb67a14897731137dfc92098d8388b0a.js' from origin 'https://cakesdecor.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I tried to make the respective file public in S3 and also added CORS policy:
[
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET"
],
"AllowedOrigins": [
"https://cakesdecor.com"
],
"ExposeHeaders": []
}
]