openfoodfacts / openfoodfacts-server

Open Food Facts database, API server and web interface - 🐪🦋 Perl, CSS and JS coders welcome 😊 For helping in Python, see Robotoff or taxonomy-editor
http://openfoodfacts.github.io/openfoodfacts-server/
GNU Affero General Public License v3.0
653 stars 382 forks source link

Add a way to indicate to the API that queries are from a server and that the IP should not be used as an indication of the country of a product #6323

Open stephanegigandet opened 2 years ago

stephanegigandet commented 2 years ago

What

From @blazern :

Proposed solution

Alternatives considered

We could try to differentiate client IP ranges from server IP ranges, but that's likely to be error prone.

alexgarel commented 2 years ago

Is that a requirements to set this kind of info ? Or, in doubt, could we avoid it ?

Because I would go for an opt-in in this case:

  1. letting the app tell the country
  2. or having a parameter telling we want to use "autodetection" by ip. Or alternatively a parameter named direct_use to tell the server that the client is using the API directly, so that if we make assumptions based on this fact (like setting country based on ip)

I will then change OFF web app to use this parameter. And we may add some exceptions in the code for knows apps, to set parameter automatically.

stephanegigandet commented 2 years ago

@alexgarel good idea.

For 1, we already have a cc (country code) parameter for the API.

For 2, I would go with a very specific parameter name, like use_ip_address_to_detect_country. A bit long but at least it's very clear what it does.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 90 days with no activity.