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 -> https://xxxx.s3.yyyy.amazonaws.com/zzzz.jpeg
xxxx: bucket name, yyyy:region zzzz:filename
I have already defined s3 domain in next.config.org 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. .
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!
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.
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:
https://docs.digitalocean.com/products/spaces/how-to/enable-cdn/
If you are using Amazon S3, you could setup CloudFront as described here:
https://aws.amazon.com/cloudfront/getting-started/S3/
Let me know how it goes!
Best,
Bobby