Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/platform/cloudflare/auth.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ export const authPlatform: AuthPlatform = {
// reach a private network. A Worker has no private network to reach: its
// fetches leave through Cloudflare to the public internet. The rest of the
// contract (HTTPS, GET or HEAD, redirects returned unfollowed) holds here.
// CIMD asks for `redirect: 'error'`, which workerd's Request rejects, so
// the redirect is replaced by `manual`: a 3xx comes back as a non-200 that
// CIMD refuses.
fetchClientMetadataResource: (input, init) => {
const request = new Request(input, init)
const request = new Request(input, { ...init, redirect: 'manual' })
if (new URL(request.url).protocol !== 'https:') {
throw new TypeError('CIMD metadata must be fetched over HTTPS')
}
if (request.method !== 'GET' && request.method !== 'HEAD') {
throw new TypeError('CIMD metadata is fetched with GET or HEAD only')
}
return fetch(request, { redirect: 'manual' })
return fetch(request)
},
// Comparing the schema takes four D1 round trips, and every new isolate
// would pay them before reading a session. The configuration only changes
Expand Down
Loading