add missing file
This commit is contained in:
30
id.saladeaula.digital/client/app/routes/upstream.ts
Normal file
30
id.saladeaula.digital/client/app/routes/upstream.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import type { Route } from './+types'
|
||||
|
||||
export async function action({ request, context }: Route.ActionArgs) {
|
||||
const url = new URL(request.url)
|
||||
const issuerUrl = new URL(url.pathname, context.cloudflare.env.ISSUER_URL)
|
||||
const r = await fetch(issuerUrl.toString(), {
|
||||
method: request.method,
|
||||
headers: request.headers,
|
||||
body: await request.text()
|
||||
})
|
||||
|
||||
return new Response(await r.text(), {
|
||||
status: r.status,
|
||||
headers: r.headers
|
||||
})
|
||||
}
|
||||
|
||||
export async function loader({ request, context }: Route.ActionArgs) {
|
||||
const url = new URL(request.url)
|
||||
const issuerUrl = new URL(url.pathname, context.cloudflare.env.ISSUER_URL)
|
||||
const r = await fetch(issuerUrl.toString(), {
|
||||
method: request.method,
|
||||
headers: request.headers
|
||||
})
|
||||
|
||||
return new Response(await r.text(), {
|
||||
status: r.status,
|
||||
headers: r.headers
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user