summaryrefslogtreecommitdiff
path: root/app/lib/image-proxy.ts
diff options
context:
space:
mode:
authoryyamashita <yyamashita@hetzner.yyamashita.com>2026-06-17 22:27:47 +0900
committeryyamashita <yyamashita@hetzner.yyamashita.com>2026-06-17 22:27:47 +0900
commit5f653a4c9f7c76d461ee4377fb4e025771cff872 (patch)
tree4cb8e8ee191bc082a69c10b99c717df948c01cca /app/lib/image-proxy.ts
parentb323ad4824cc62cf54a9bfa4f9f68dda4b783323 (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.ts4
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)}`;
+}