From 9125b09b2a682047054a66d33b98203c7fd111f7 Mon Sep 17 00:00:00 2001 From: Nils Pukropp Date: Wed, 25 Mar 2026 11:14:06 +0100 Subject: [PATCH] merged --- frontend/astro.config.mjs | 4 ++++ frontend/src/pages/uploads/[...path].astro | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 frontend/src/pages/uploads/[...path].astro diff --git a/frontend/astro.config.mjs b/frontend/astro.config.mjs index bf157a3..941943b 100644 --- a/frontend/astro.config.mjs +++ b/frontend/astro.config.mjs @@ -7,6 +7,10 @@ import node from '@astrojs/node'; // https://astro.build/config export default defineConfig({ + output: 'server', + image: { + service: { entrypoint: 'astro/assets/services/noop' } + }, vite: { plugins: [tailwindcss()] }, diff --git a/frontend/src/pages/uploads/[...path].astro b/frontend/src/pages/uploads/[...path].astro new file mode 100644 index 0000000..fba467a --- /dev/null +++ b/frontend/src/pages/uploads/[...path].astro @@ -0,0 +1,20 @@ +--- +const { path } = Astro.params; +const API_URL = import.meta.env.PUBLIC_API_URL || 'http://localhost:3000'; + +const response = await fetch(`${API_URL}/uploads/${path}`); + +if (!response.ok) { + return new Response(null, { status: 404 }); +} + +const blob = await response.blob(); +const contentType = response.headers.get('content-type'); + +return new Response(blob, { + headers: { + 'content-type': contentType || 'application/octet-stream', + 'cache-control': 'public, max-age=3600' + } +}); +---