Fix image host whitelist for next

This commit is contained in:
Lee 2022-11-17 06:23:45 +00:00
parent 50e9028250
commit e59d2ef537
No known key found for this signature in database
GPG Key ID: 6EA25896ECCB3121

@ -1,4 +1,7 @@
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const imageUrlParts = process.env.NEXT_PUBLIC_SITE_URL.split("://");
const nextConfig = { const nextConfig = {
reactStrictMode: true, reactStrictMode: true,
output: "standalone", output: "standalone",
@ -10,11 +13,13 @@ const nextConfig = {
{ {
protocol: "http", protocol: "http",
hostname: "localhost", hostname: "localhost",
port: "3000",
pathname: "/api/files/**", pathname: "/api/files/**",
}, },
{ {
protocol: "http", protocol: imageUrlParts[0],
hostname: process.env.NEXT_PUBLIC_SITE_URL, hostname: imageUrlParts[1].split(":")[0],
port: "443",
pathname: "/api/files/**", pathname: "/api/files/**",
}, },
], ],