This commit is contained in:
2026-03-25 11:14:06 +01:00
parent 86e8798c69
commit 9125b09b2a
2 changed files with 24 additions and 0 deletions

View File

@@ -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'
}
});
---