fix(app): replace CORS Access-Control-Allow-Origin * with explicit localhost origin

Add setCorsHeaders() and handleCorsOptions() helpers in server/dev-auth.ts.
Replace wildcard CORS origin with http://localhost:5173 in all Vite plugins
and claude-proxy.ts. Include Authorization in allowed CORS headers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-06 01:25:10 +00:00
co-authored by Claude Opus 4.6
parent cc7d9fc19e
commit 4dc9588c8a
6 changed files with 36 additions and 23 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import type { Plugin } from 'vite'
import type { Connect } from 'vite'
import Parser from 'rss-parser'
import { validateDevAuth } from './server/dev-auth'
import { validateDevAuth, setCorsHeaders } from './server/dev-auth'
export interface RssArticle {
title: string
@@ -140,7 +140,7 @@ function createRssMiddleware() {
try {
const articles = await fetchRssFromUrls(safe)
res.setHeader('Content-Type', 'application/json')
res.setHeader('Access-Control-Allow-Origin', '*')
setCorsHeaders(res)
res.setHeader('Cache-Control', 'public, max-age=300')
res.end(JSON.stringify({ articles }))
} catch (err) {