在 Next js Image 中,我使用以下 url
https://amandascookin.com/wp-content/uploads/2012/02/Crispy-Potatoes-680.jpg
。这给了我403
。当我使用 nextjs
代码沙箱尝试相同的操作时,它给出了很好的结果。我不确定为什么它会发生在我的原始项目中,并且在我的下一个 js 配置中我使用以下内容
images: {
remotePatterns: [
{
protocol: "https",
hostname: "**",
},
{
protocol: "http",
hostname: "**",
},
],
},
有人可以帮我解决这个问题吗?
您可以在图像配置中添加一个域,例如:
images:{
domains:["amandascookin.com"]
}
它位于根目录下的 next.config.js 文件中。希望有帮助。