Posts Learn Components Snippets Categories Tags Tools About

How to Configure Next.Js Image Hostname

Learn how to configure next js image hosting and prevent invalid src prop error

Created on Feb 24, 2023


In this short snippet you will learn how to prevent “Error: Invalid src prop” in Next Js. Let's get started!

Open next.config.js and add it in the ”images” config

Add the domain section for your backend / image domain server
/** @type {import('next').NextConfig} */
const nextConfig = {
    images: { domains: [''], },

module.exports = nextConfig
Once you have done so restart the server and you should be able to see the image.

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️

Load comments for How to Configure Next.Js Image Hostname