2

I have two Angular applications that are connecting to the same Firebase/Firestore instance:

I have implemented Firebase Cloud Functions with Express, but would like to conditionally manipulate the data being returned based on which applications is making the request. I have tried using req.get('origin') to detect the origin of the request, but that always returns the URL provided by the Firebase Cloud (cloudfunctions.net/).

Can I access this information another way?

Hughes
  • 985
  • 2
  • 9
  • 29

1 Answers1

3

You are looking for the 'Referer' HTTP request header field.

To access it you can do either:

req.get('Referrer')
req.get('Referer')
req.headers.referer
req.headers.referrer

It checks for both spelling, there is no need to test which is being passed.