Reputation: 1
How to setup next config to get images from http and https protocol
`/** @type {import('next').NextConfig} */
const nextConfig = {
images: {
remotePatterns: [
{
protocol: "https" || "http",
hostname: "**",
port: "",
pathname: "/**",
},
],
},
};
export default nextConfig;`
But it seems the http isn't working
Upvotes: 0
Views: 18
Reputation: 574
that's because using ||
checks wether one or more of the expressions are true, since "https"
is converted to true, it completely ignores the second string "http"
, you can do this instead:
/** @type {import('next').NextConfig} */
const nextConfig = {
images: {
remotePatterns: [
{
protocol: "https",
hostname: "**",
port: "",
pathname: "/**",
},
{
protocol: "http",
hostname: "**",
port: "",
pathname: "/**",
},
],
},
};
export default nextConfig;
Upvotes: 0