feat: add bypass api
This commit is contained in:
parent
478b8e496b
commit
6563a9c273
|
|
@ -0,0 +1,16 @@
|
|||
// This API is used to bypass the restriction that the Cloudflare Image Resizing service's onerror=redirect can only be used in current domain
|
||||
import { redirect } from "next/navigation"
|
||||
import { type NextRequest, NextResponse } from "next/server"
|
||||
|
||||
import { getQuery } from "~/lib/server-helper"
|
||||
|
||||
export const runtime = "edge"
|
||||
|
||||
export const GET = async (req: NextRequest) => {
|
||||
const query = getQuery(req)
|
||||
if (query.url) {
|
||||
redirect(query.url)
|
||||
} else {
|
||||
return NextResponse.json({ error: "Missing url" })
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue