I am wondering if there's a way for me to get the full URL of the current request inside the API route (pages/api/myapi), the only returned response I see that's close to what I need is the req.headers.referer, but I am not sure if this value will always be in the headers. The type for that is string | undefined.
There's also the req.headers.host and req.headers.origin but it's missing the protocol.
The end goal is to get the full URL inside my API handler function.i.e. "https://example.org/api/test"