next/image allow all domains
Unanswered
Siamese posted this in #help-forum
SiameseOP
Hi! How can I make so all domains will work?
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
images: {
domains: [],
},
}
module.exports = nextConfig
6 Replies
IIRC you can pass "**" to
[Docs reference](https://nextjs.org/docs/app/api-reference/components/image#remotepatterns)
hostname
. I might be wrong tho. Also do know that this is potentially unsafe, so dont do it unless you really have to. You can take a look at the link below of how you can use the ** in other ways which might be better. [Docs reference](https://nextjs.org/docs/app/api-reference/components/image#remotepatterns)
yes, it is not recommend to allow all hostname. because everyone can use your endpoint to do the image optimization. also if you are hosting on vercel you may get an unexpected bill
SiameseOP
Didn't know that, but I'm self hosting
I will only use pics from local directory, discord server logos, discord avatars and my cdn
then it is better to add the domain of discord and your cdn
SiameseOP
k