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

View File

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