S3 Images are getting loaded very slow

I am running a nextjs application Ubuntu 22.04 droplet@2GB RAM 1AMD vCPU 50GB storage . All other contents are getting loaded very fast except images. Images are getting loaded very slow on page load. Each image has reduced size in kb’s and getting loaded in the browser in an optimized way.

However I found out the issue ,** the issue is images from external sources(aws S3 bucket , cloudinary ) are getting loaded very slow**.

s3 image url format ->

xxxx: bucket name, yyyy:region zzzz:filename

I have already defined s3 domain in as per nextjs docs.

But local images are getting loaded very fast.

I have gone through every possible docs of digital ocean but did not find a solution.

If anybody know how to resolve it Please let me know. .

Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
October 2, 2022

Hi there,

Are you using the DigitalOcean Spaces as your S3 storage or Amazon S3?

If you are using DigitalOcean Spaces, you could enabled CDN as described here:

If you are using Amazon S3, you could setup CloudFront as described here:

Let me know how it goes!