0

I have a google cloud API function that is built on Node.js. I want to find the source of API request. I mean request header referer. I have tried using req.get('referer') but that was returning null. Can I access this information in any other way? Please help

1 Answers1

1

Doing a quick test for the same situation you're handling, it works without any issue.

It was tested with: curl “<FUNCTION_ URL>” --referer "https://google.com"

And to get the request header, I used: req.get(‘Referrer’)

Have in mind that if the URL is not valid, the result would be undefined, as follows:

enter image description here

If the solution provided still does not work, it might be an issue with your request to Cloud Functions.