Return 404 JSON for oauth-protected-resource discovery probes.

Stop 302ing Claude well-known checks to /login without advertising OAuth.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-11-02 22:30:26 -06:00
co-authored by Cursor
parent 7fd040ad62
commit ab1d6acb2d
4 changed files with 25 additions and 5 deletions
+3 -1
View File
@@ -16,7 +16,9 @@ export default defineEventHandler((event) => {
path === '/login' ||
// Claude MCP discovery — never 302 to /login (JSON 404 handlers serve these).
path === '/.well-known/oauth-authorization-server' ||
path === '/.well-known/openid-configuration'
path === '/.well-known/openid-configuration' ||
path === '/.well-known/oauth-protected-resource' ||
path.startsWith('/.well-known/oauth-protected-resource/')
) {
return
}
@@ -0,0 +1,7 @@
/** Claude discovery probe — no OAuth; never redirect to /login. */
export default defineEventHandler((event) => {
setResponseStatus(event, 404)
setResponseHeader(event, 'Content-Type', 'application/json')
setResponseHeader(event, 'Cache-Control', 'no-store')
return { error: 'not found' }
})
@@ -0,0 +1,7 @@
/** Claude discovery probe — no OAuth; never redirect to /login. */
export default defineEventHandler((event) => {
setResponseStatus(event, 404)
setResponseHeader(event, 'Content-Type', 'application/json')
setResponseHeader(event, 'Cache-Control', 'no-store')
return { error: 'not found' }
})