I am trying to build an application that executes logic ONLY if the origin URL is on allowlist. I am trying to get the origin URL inside of a Firebase Function using the following methods:
I tried using these from this stack overflow post:
req.get('Referrer')
req.get('Referer')
req.headers.referer
req.headers.referrer
All return undefined.
I tried to to put together this function from this stack overflow post:
function getOriginUrl(req: any) {
return req.protocol + '://' + req.get('host') + req.originalUrl
}
This returns the base url of my cloud functions
https://us-central1-secured-1q4fq.cloudfunctions.net/
What I would actually like to see is the url that the post was made from. I am using this to make the post so I expect to see:
https://reqbin.com
question from:
https://stackoverflow.com/questions/65943377/how-do-i-get-the-origin-url-of-a-firebase-function-request 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…