问题
Is it possible to know the hostname of the source of an incoming request to a cloud firestore document? I would like to write a database rule of the form allow write: if request.resource.data.source_host_name == some_predefined_value
. This is a web application so I'm trying to find a good way to limit who gets to write to my database without using traditional auth methods.
回答1:
That sort of rule is not possible with Cloud Firestore. It also wouldn't be very secure, as it's possible to spoof source IP addresses.
If you want to limit who can access your database, the only supported mechanism is through security rules and Firebase Authentication.
来源:https://stackoverflow.com/questions/49385599/is-it-possible-to-determine-the-source-of-an-incoming-request