fix(engine): return 204 for /favicon.ico instead of 401
Browser requests to /favicon.ico were hitting the auth middleware. Added explicit route + auth bypass.
This commit is contained in:
parent
bd4b79bd7b
commit
5cc46b3e9b
@ -117,6 +117,10 @@ app.use('*', async (c, next) => {
|
|||||||
// UI (no auth, served before auth middleware)
|
// UI (no auth, served before auth middleware)
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|
||||||
|
app.get('/favicon.ico', (c) => {
|
||||||
|
return new Response(null, { status: 204 })
|
||||||
|
})
|
||||||
|
|
||||||
app.get('/ui', (c) => {
|
app.get('/ui', (c) => {
|
||||||
return c.html(UI_HTML)
|
return c.html(UI_HTML)
|
||||||
})
|
})
|
||||||
@ -143,7 +147,7 @@ app.get('/schema', async (c) => {
|
|||||||
|
|
||||||
// Auth middleware for all routes except health, schema, ui, and POST /events (which has its own dual auth)
|
// Auth middleware for all routes except health, schema, ui, and POST /events (which has its own dual auth)
|
||||||
app.use('*', async (c, next) => {
|
app.use('*', async (c, next) => {
|
||||||
if (c.req.path === '/health' || c.req.path === '/schema' || c.req.path.startsWith('/ui')) return next()
|
if (c.req.path === '/health' || c.req.path === '/schema' || c.req.path === '/favicon.ico' || c.req.path.startsWith('/ui')) return next()
|
||||||
if (c.req.method === 'POST' && c.req.path === '/events') return next()
|
if (c.req.method === 'POST' && c.req.path === '/events') return next()
|
||||||
return bearerAuth(c.env.API_TOKEN)(c, next)
|
return bearerAuth(c.env.API_TOKEN)(c, next)
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user