1

I want to serve images from an external CDN. This means:

  1. I don't want to store images on Magento's server or use its image cache
  2. I want to store image URLs in the database and use them to serve images directly in the browser via CDN
  3. I want to use transformations (width/300/height/300/foo.jpg) (this is not related to Magento, but I'm adding it here in case it complicates things)

Is Magento 2 prepared to serve images via URL out of the box, or does it require development work or changing anything in Magento's innards? If so, how much effort is required to configure Magento to serve images as such?

To be clear, I already have an Asset Management system with a CDN that furnishes image URLs. I want Magento to consume it.

3

You can tell Magento to use static files and media files from a CDN from the admin dashboard. Go to Stores > Configuration. Under the Web tab you can link the CDN in Base URL for Static View Files and Base URL for User Media Files. Don't forget to flush the cache after you change the settings.

  • which link PUT on Base URL for Static View Files and Base URL for User Media Files field ? – sumeet bajaj 2 days ago
0

But magento2 wont allow you to add any other URL from admin

it throws error message

"Invalid Base URL for User Media Files. Specify a URL or path that starts with placeholder(s): {{unsecure_base_url}}, and ends with "/". An empty value is allowed as well."

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.