Skip to content

Commit

Permalink
fix:vercel
Browse files Browse the repository at this point in the history
  • Loading branch information
xizeyoupan committed Mar 16, 2024
1 parent 8845f6c commit f3414c3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export const get_url = (ctx) => {
const runtime = get_runtime()
const perfix = ctx.req.header('X-Forwarded-Host') || ctx.req.header('X-Forwarded-Url')
let req_url = perfix ? perfix + getPathFromURL(ctx.req.url.split('?')[0]) : ctx.req.url.split('?')[0]
if (!req_url.startsWith('http')) req_url = 'http://' + req_url
if (runtime === 'vercel') req_url = req_url.replace('http://', 'https://')
return req_url
}

0 comments on commit f3414c3

Please sign in to comment.