COR error when using cloudfront and rails

I’m trying to configure my Ruby on Rails applications to use cloud front. CSS and JS seem to work fine. But I’m getting COR errors for font assets

Caddyfile

https://domain.com {
  encode zstd gzip
  tls engineering@domain.org
  header / {
    Strict-Transport-Security "max-age=31536000"
  }
  @assets {
    path /assets/*
  }
  header @assets Access-Control-Allow-Origin "*"
  header @assets Access-Control-Allow-METHODS “GET, POST”
  reverse_proxy unix//home/deploy/apps/rails-application/shared/tmp/sockets/rails-application-puma.sock
}

error when fetching a font

has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource```

### config/environments/production.rb
```ruby
  config.public_file_server.headers = {
    'Access-Control-Allow-Origin' => '*'
  }

This topic was automatically closed after 30 days. New replies are no longer allowed.