diff options
| author | yyamashita <yyamashita@hetzner.yyamashita.com> | 2026-06-17 22:27:47 +0900 |
|---|---|---|
| committer | yyamashita <yyamashita@hetzner.yyamashita.com> | 2026-06-17 22:27:47 +0900 |
| commit | 5f653a4c9f7c76d461ee4377fb4e025771cff872 (patch) | |
| tree | 4cb8e8ee191bc082a69c10b99c717df948c01cca /app/lib/image-proxy.ts | |
| parent | b323ad4824cc62cf54a9bfa4f9f68dda4b783323 (diff) | |
Add image proxy endpoint to avoid mixed content issues
Serve external event images through /api/image?url=<encoded> so HTTP
image URLs from venue sites are fetched server-side and delivered over
HTTPS. Validates Content-Type is image/*, blocks private IPs (SSRF),
and caches responses in memory (24h TTL, 200-entry LRU).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'app/lib/image-proxy.ts')
| -rw-r--r-- | app/lib/image-proxy.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/lib/image-proxy.ts b/app/lib/image-proxy.ts new file mode 100644 index 0000000..b9af3bf --- /dev/null +++ b/app/lib/image-proxy.ts @@ -0,0 +1,4 @@ +export function proxyImageUrl(url: string | null | undefined): string | null { + if (!url) return null; + return `/api/image?url=${encodeURIComponent(url)}`; +} |
