在下一个js图像中,我使用以下网址`https://amandasookin.com/wp-content/uploads/2012/02/Crispy-Potatoes-680.jpg`。这给了我`403`

问题描述 投票:0回答:1

在 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: "**",
  },
],

},

有人可以帮我解决这个问题吗?

reactjs image next.js
1个回答
0
投票

您可以在图像配置中添加一个域,例如:

    images:{
    domains:["amandascookin.com"]
    }

它位于根目录下的 next.config.js 文件中。希望有帮助。

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.