You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: internal/start/start.go
+8-3Lines changed: 8 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -349,9 +349,14 @@ EOF
349
349
ApiHost: utils.Config.Hostname,
350
350
ApiPort: utils.Config.Api.Port,
351
351
BearerToken: fmt.Sprintf(
352
-
// Pass down apikey as Authorization header for backwards compatibility with legacy JWT.
353
-
// If Authorization header is already set, Kong simply skips evaluating this Lua script.
354
-
`$((function() return (headers.apikey == '%s' and 'Bearer %s') or (headers.apikey == '%s' and 'Bearer %s') or headers.apikey end)())`,
352
+
// If Authorization header is set to a self-minted JWT, we want to pass it down.
353
+
// Legacy supabase-js may set Authorization header to Bearer <apikey>. We must remove it
354
+
// to avoid failing JWT validation.
355
+
// If Authorization header is missing, we want to match against apikey header to set the
356
+
// default JWT for downstream services.
357
+
// Finally, the apikey header may be set to a legacy JWT. In that case, we want to copy
358
+
// it to Authorization header for backwards compatibility.
359
+
`$((function() return (headers.authorization ~= nil and headers.authorization:sub(1, 10) ~= 'Bearer sb_' and headers.authorization) or (headers.apikey == '%s' and 'Bearer %s') or (headers.apikey == '%s' and 'Bearer %s') or headers.apikey end)())`,
0 commit comments