Skip to content
Discussion options

You must be logged in to vote

The easiest solution is to read the URL from env vars. Alternatively, with access to the req object, you can get the client URL in the server with

const url = `${protocol}://${req.headers.host}`

Be aware that this makes you vulnerabe to the Host Header Attack, check if your host is protected against it (Vercel isn't vulnerable).

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Timer
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
4 participants