diff --git a/nuxt.config.ts b/nuxt.config.ts index 86c61a82..5944082a 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -1,6 +1,6 @@ import { fileURLToPath } from 'node:url' import Inspect from 'vite-plugin-inspect' -import { isCI } from 'std-env' +import { isCI, isDevelopment } from 'std-env' import { i18n } from './config/i18n' const isPreview = process.env.PULL_REQUEST === 'true' @@ -90,7 +90,7 @@ export default defineNuxtConfig({ routeRules: { '/api/og-image/**': { static: isCI, - cache: !isCI + cache: !isCI && !isDevelopment ? { maxAge: 86400 } // 1 day : {}, }, diff --git a/server/api/og-image/[url].ts b/server/api/og-image/[url].ts index acc97746..51e1c280 100644 --- a/server/api/og-image/[url].ts +++ b/server/api/og-image/[url].ts @@ -108,7 +108,9 @@ export default defineEventHandler(async (event) => { return } - await sendRedirect(event, ogImageUrl) + return $fetch(ogImageUrl, { + responseType: 'stream', + }) } catch (error) { throw createError({