update cf context on id
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import type { Route } from './+types/upstream'
|
||||
|
||||
import { cloudflareContext } from '@repo/auth/context'
|
||||
|
||||
export const loader = proxy
|
||||
export const action = proxy
|
||||
|
||||
@@ -9,8 +11,9 @@ async function proxy({
|
||||
request,
|
||||
context
|
||||
}: Route.ActionArgs): Promise<Response> {
|
||||
const cloudflare = context.get(cloudflareContext)
|
||||
const { pathname, search } = new URL(request.url)
|
||||
const url = new URL(pathname + search, context.cloudflare.env.ISSUER_URL)
|
||||
const url = new URL(pathname + search, cloudflare.env.ISSUER_URL)
|
||||
const headers = new Headers(request.headers)
|
||||
|
||||
const shouldCache =
|
||||
@@ -44,7 +47,7 @@ async function proxy({
|
||||
})
|
||||
|
||||
// Store asynchronously (don’t block response)
|
||||
context.cloudflare.ctx.waitUntil(cache.put(cacheKey, cacheResponse))
|
||||
cloudflare.ctx.waitUntil(cache.put(cacheKey, cacheResponse))
|
||||
}
|
||||
|
||||
const contentType = response.headers.get('content-type') || ''
|
||||
|
||||
Reference in New Issue
Block a user