1

I have configured ActiveStorage and it works properly.

However I need to change the final URLs returned to the users, so that they use a CDN.

Currently the final image URL is:

https://mywebsite.nyc1.digitaloceanspaces.com/...

But I need this instead:

https://mywebsite.nyc1.cdn.digitaloceanspaces.com/...

Is it possible to achieve that in Rails 6?

collimarco
  • 34,231
  • 36
  • 108
  • 142

1 Answers1

-2

It seems not possible to configure Rails 6.0 to use a CDN at the moment... However I was able to achieve that by using:

variant.service_url.sub('digitaloceanspaces.com', 'cdn.digitaloceanspaces.com')
collimarco
  • 34,231
  • 36
  • 108
  • 142