Back

Appwrite Locale service problem

  • 0
  • Self Hosted
  • Locale
SpencerSama
14 Nov, 2023, 12:43

When I want to retrieve the country of each user, Appwrite's Local instance always returns an object with its data as Country "UNKNOWN".

{ip: 172.22.0.1, countryCode: --, country: Unknown, continentCode: --, continent: Unknown, eu: false, currency: }

TL;DR
The user is experiencing a problem with the Appwrite Locale service. When using the IP address with the Appwrite port on their server, it works fine and returns the correct object. However, when using the reverse proxy domain name, the problem occurs and it returns an unknown country. The solution provided is to specify trusted IPs in the configuration and set insecure to true if it's certain the Appwrite instance will not be hit from any other source. It's also mentioned that traefik needs to be configured to trust the sender. The user's environment is in production and they are using Flutter 3.13.2. They are using
Haimantika
14 Nov, 2023, 16:42
Drake
14 Nov, 2023, 17:49

The country lookup is done using IP address. Looks like the IP address that's being detected is a local private IP address. Something needs extra configuring with your Appwrite instance. How's your environment set up (what do you have in front of Appwrite)?

SpencerSama
14 Nov, 2023, 17:52

Yes

SpencerSama
14 Nov, 2023, 17:54

My environment is in production

Drake
14 Nov, 2023, 19:34

would you please provide more details?

SpencerSama
14 Nov, 2023, 21:18

I use Flutter 3.13.2

SpencerSama
14 Nov, 2023, 21:18

Appwrite 11.0.0

SpencerSama
14 Nov, 2023, 21:30

in front of Appwrite everything is okay

Drake
14 Nov, 2023, 21:32

Apparently not. Do you have anything in front of Appwrite?

SpencerSama
14 Nov, 2023, 21:33

On my server?

Drake
14 Nov, 2023, 21:33

Or wherever

SpencerSama
14 Nov, 2023, 21:35

On my server I only have Apache up front

Drake
14 Nov, 2023, 21:35

Is apache in a docker container?

SpencerSama
14 Nov, 2023, 21:35

No

Drake
14 Nov, 2023, 21:46

So just like any other backend server, Appwrite uses the IP of the incoming request and logs that as the users IP. When there are other systems in between the user, things get complicated. Systems will typically pass along the users IP address, but the receiving system (Appwrite) needs to trust that information. To do that, you would tell traefik to trust the sender

Drake
14 Nov, 2023, 21:47

You would specify the trusted IPs: https://doc.traefik.io/traefik/routing/entrypoints/#forwarded-headers.

If you're 100% sure the Appwrite instance will not be hit from any other source, you can set insecure to true

SpencerSama
14 Nov, 2023, 21:50

I've just noticed that when I use my IP address with the port where Appwrite is installed on my server, they all work very well and I even have the right object {ip: 154.72.171.113, countryCode: CM, country: Cameroon, continentCode: AF, continent: Africa, eu: false, currency: }

But when I use the reverse proxy domain name linked to the ip address mentioned above, the problem starts all over again.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more