Skip to content

Commit 4730b3a

Browse files
authored
Merge branch 'main' into jacek/improve-auth-middleware-error-message
2 parents f63c2db + a8c64cc commit 4730b3a

35 files changed

Lines changed: 1092 additions & 40 deletions
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/backend': patch
3+
---
4+
5+
Fix `clerkFrontendApiProxy` to derive the `Clerk-Proxy-Url` header and Location rewrites from `x-forwarded-proto`/`x-forwarded-host` headers instead of the raw `request.url`. Behind a reverse proxy, `request.url` resolves to localhost, causing FAPI to receive an incorrect proxy URL. The fix uses the same forwarded-header resolution pattern as `ClerkRequest`.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/fastify': minor
3+
---
4+
5+
Add Frontend API proxy support to `@clerk/fastify` via the `frontendApiProxy` option on `clerkPlugin`. When enabled, requests matching the proxy path (default `/__clerk`) are forwarded to Clerk's Frontend API, allowing Clerk to work in environments where direct API access is blocked by ad blockers or firewalls. The `proxyUrl` for auth handshake is automatically derived from the request when `frontendApiProxy` is configured.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
'@clerk/shared': patch
4+
---
5+
6+
Narrow the error conditions that trigger the unauthenticated flow (sign-out) to only high-confidence authentication failures (401, 422). Previously, all 4xx errors — including 429 rate limits — were treated as auth failures, which could sign users out during transient rate limiting. Non-auth errors from `setActive` now propagate to the caller instead of being silently swallowed.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/express': patch
3+
---
4+
5+
Fix empty path fallback for `frontendApiProxy` to prevent intercepting all requests when `path` resolves to an empty string

.changeset/hono-proxy-support.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/hono': minor
3+
---
4+
5+
Add Frontend API proxy support to `@clerk/hono` via the `frontendApiProxy` option on `clerkMiddleware`. When enabled, requests matching the proxy path (default `/__clerk`) are forwarded to Clerk's Frontend API, allowing Clerk to work in environments where direct API access is blocked by ad blockers or firewalls. The `proxyUrl` for auth handshake is automatically derived from the request when `frontendApiProxy` is configured.

.changeset/yellow-vans-beg.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@clerk/expo": minor
3+
---
4+
5+
Adds support for Expo SDK 55

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ jobs:
305305
"nuxt",
306306
"react-router",
307307
"custom",
308+
"hono",
308309
]
309310
test-project: ["chrome"]
310311
include:

integration/presets/envs.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ const withWaitlistMode = withEmailCodes
136136
.setEnvVariable('private', 'CLERK_SECRET_KEY', instanceKeys.get('with-waitlist-mode').sk)
137137
.setEnvVariable('public', 'CLERK_PUBLISHABLE_KEY', instanceKeys.get('with-waitlist-mode').pk);
138138

139+
const withEmailCodesProxy = withEmailCodes
140+
.clone()
141+
.setId('withEmailCodesProxy')
142+
.setEnvVariable('private', 'CLERK_PROXY_ENABLED', 'true');
143+
139144
const withSignInOrUpFlow = withEmailCodes
140145
.clone()
141146
.setId('withSignInOrUpFlow')
@@ -222,6 +227,7 @@ export const envs = {
222227
withDynamicKeys,
223228
withEmailCodes,
224229
withEmailCodes_destroy_client,
230+
withEmailCodesProxy,
225231
withEmailCodesQuickstart,
226232
withEmailLinks,
227233
withKeyless,

integration/presets/longRunningApps.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export const createLongRunningApps = () => {
8686
* Hono apps
8787
*/
8888
{ id: 'hono.vite.withEmailCodes', config: hono.vite, env: envs.withEmailCodes },
89+
{ id: 'hono.vite.withEmailCodesProxy', config: hono.vite, env: envs.withEmailCodesProxy },
8990
] as const;
9091

9192
const apps = configs.map(longRunningApplication);

integration/templates/hono-vite/src/server/main.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ import ViteExpress from 'vite-express';
88

99
const app = new Hono();
1010

11+
const proxyEnabled = process.env.CLERK_PROXY_ENABLED === 'true';
12+
1113
app.use(
1214
'*',
1315
clerkMiddleware({
1416
publishableKey: process.env.VITE_CLERK_PUBLISHABLE_KEY,
17+
...(proxyEnabled ? { frontendApiProxy: { enabled: true } } : {}),
1518
}),
1619
);
1720

0 commit comments

Comments
 (0)