# GeoIP not works

**URL:** https://community.zammad.org/t/geoip-not-works/11601
**Category:** Technical assistance
**Created:** [June 17, 2023, 12:02pm UTC](https://community.zammad.org/t/geoip-not-works/11601 "2023-06-17T12:02:10Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![kotov228](https://community.zammad.org/user_avatar/community.zammad.org/kotov228/32/6994_2.png) [@kotov228](https://community.zammad.org/u/kotov228)
#### Post date: [June 17, 2023, 12:02pm UTC](https://community.zammad.org/t/geoip-not-works/11601/1 "2023-06-17T12:02:10Z")

</div>

- Used Zammad version: 5.4.0
- Used Zammad installation type: docker-compose
- Operating system: ubuntu
- Browser + version: safari latest

![Screenshot 2023-06-17 at 14.58.55](https://community.zammad.org/uploads/default/original/2X/2/2695090a5b7e8028100a319bebfe12416d07b6a8.png)  
logs

```auto
zammad-websocket_1 | E, [2023-06-16T12:38:55.699460#1-5380] ERROR -- : cannot interpret as address: 194.44. ***.*** , 172.18.0.1 (Resolv::ResolvError)
zammad-websocket_1 | lib/sessions/event/chat_session_init.rb:39:in `run'
zammad-websocket_1 | lib/sessions/event.rb:17:in `run'
zammad-websocket_1 | lib/websocket_server.rb:102:in `onmessage'
zammad-websocket_1 | lib/websocket_server.rb:27:in `block (3 levels) in run'
zammad-websocket_1 | lib/websocket_server.rb:12:in `run'

```

How to get GeoIP working ?

---

<div class="post-metadata">

### Author: ![YetAnotherGerrit](https://community.zammad.org/user_avatar/community.zammad.org/yetanothergerrit/32/8413_2.png) [@YetAnotherGerrit](https://community.zammad.org/u/YetAnotherGerrit)
#### Post date: [June 21, 2023, 4:14pm UTC](https://community.zammad.org/t/geoip-not-works/11601/2 "2023-06-21T16:14:16Z")

</div>

Have you enabled “Geo IP Service”?  
[https://admin-docs.zammad.org/en/latest/settings/system/services.html](https://admin-docs.zammad.org/en/latest/settings/system/services.html)

Is your Zammad host able to reach the internet?  
If your Zammad host needs a proxy to reach the internet, is it configured?  
[https://admin-docs.zammad.org/en/latest/settings/system/network.html](https://admin-docs.zammad.org/en/latest/settings/system/network.html)

---

<div class="post-metadata">

### Author: ![kotov228](https://community.zammad.org/user_avatar/community.zammad.org/kotov228/32/6994_2.png) [@kotov228](https://community.zammad.org/u/kotov228)
#### Post date: [June 23, 2023, 12:27pm UTC](https://community.zammad.org/t/geoip-not-works/11601/3 "2023-06-23T12:27:55Z")

</div>

> Have you enabled “Geo IP Service”?

Geo IP Service - enabled by default.

> Is your Zammad host able to reach the internet?

Server doesn’t have any restriction for accessing internet and doesn’t require proxy.

---

<div class="post-metadata">

### Author: ![MrGeneration](https://community.zammad.org/user_avatar/community.zammad.org/mrgeneration/32/9260_2.png) [@MrGeneration](https://community.zammad.org/u/MrGeneration)
#### Post date: [June 23, 2023, 1:05pm UTC](https://community.zammad.org/t/geoip-not-works/11601/4 "2023-06-23T13:05:43Z")

</div>

The issue is this part: `194.44. ***.*** , 172.18.0.1`  
Our GeoIP service allows one IP addresses only but you’re providing your local proxy along due to a misconfiguration on your end.

---

<div class="post-metadata">

### Author: ![kotov228](https://community.zammad.org/user_avatar/community.zammad.org/kotov228/32/6994_2.png) [@kotov228](https://community.zammad.org/u/kotov228)
#### Post date: [June 23, 2023, 1:23pm UTC](https://community.zammad.org/t/geoip-not-works/11601/5 "2023-06-23T13:23:34Z")

</div>

There was no custom changes from my side.  
I provided only trusted proxy env  
RAILS\_TRUSTED\_PROXIES=[‘127.0.0.1’, ‘::1’, ‘172.18.0.1’]  
In session page Zammad users now have correct IP and resolved geo location.  
But this env didn’t fix GeoIP in tickets.  
Perhaps, this is a bug of Zammad that it tries to resolve it without extracting first member of x-forwarded-for header and use it value as is?

---

<div class="post-metadata">

### Author: ![MrGeneration](https://community.zammad.org/user_avatar/community.zammad.org/mrgeneration/32/9260_2.png) [@MrGeneration](https://community.zammad.org/u/MrGeneration)
#### Post date: [June 23, 2023, 1:40pm UTC](https://community.zammad.org/t/geoip-not-works/11601/6 "2023-06-23T13:40:10Z")

</div>

> [@kotov228](#):
>
> But this env didn’t fix GeoIP in tickets.

Of course not. Already existing information are not re-evaluated and thus are not “fixed”.

> [@kotov228](#):
>
> Perhaps, this is a bug of Zammad that it tries to resolve it without extracting first member of x-forwarded-for header and use it value as is?

It is not because Zammad expects exactly one IP which you didn’t provide before.

---

<div class="post-metadata">

### Author: ![kotov228](https://community.zammad.org/user_avatar/community.zammad.org/kotov228/32/6994_2.png) [@kotov228](https://community.zammad.org/u/kotov228)
#### Post date: [June 23, 2023, 3:01pm UTC](https://community.zammad.org/t/geoip-not-works/11601/7 "2023-06-23T15:01:45Z")

</div>

> Of course not. Already existing information are not re-evaluated and thus are not “fixed”.

I was talking about new tickets and new sessions after I set RAILS\_TRUSTED\_PROXIES env.  
I don’t expect old tickets to be fixed.

> It is not because Zammad expects exactly one IP which you didn’t provide before.

I am not interfering in this process. Below is my nginx reverse proxy config. What happens to data after nginx is a mystery to me. How exactly do you expect me to provide IPs to zammad?

```
location / {
    proxy_pass http://127.0.0.1:8080/;
    proxy_http_version 1.1;
    proxy_cache_bypass $http_upgrade;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Port $server_port;
 proxy_set_header X-Forwarded-Proto https;
}

```

---

<div class="post-metadata">

### Author: ![MrGeneration](https://community.zammad.org/user_avatar/community.zammad.org/mrgeneration/32/9260_2.png) [@MrGeneration](https://community.zammad.org/u/MrGeneration)
#### Post date: [July 17, 2023, 4:28pm UTC](https://community.zammad.org/t/geoip-not-works/11601/8 "2023-07-17T16:28:51Z")

</div>

> [@kotov228](#):
>
> I am not interfering in this process. Below is my nginx reverse proxy config. What happens to data after nginx is a mystery to me. How exactly do you expect me to provide IPs to zammad?
> 
> ```auto
> location / {
> proxy_pass http://127.0.0.1:8080/;
> proxy_http_version 1.1;
> proxy_cache_bypass $http_upgrade;
> proxy_set_header Upgrade $http_upgrade;
> proxy_set_header Connection "Upgrade";
> proxy_set_header Host $host;
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> proxy_set_header X-Forwarded-Host $host;
> proxy_set_header X-Forwarded-Port $server_port;
> proxy_set_header X-Forwarded-Proto https;
> }
> 
> ```

That configuration does not come from your Zammad based vHost but from a different proxy, correct?  
Because that would explain two instead of one (that’s how proxies work).

If you don’t want to use the nginx of your compose or just use it because it’s there but actually use a different proxy, you could hook to the containers ports directly if that helps. This may need manual tinkering and changes (which should only affect your compose file).

---

<div class="post-metadata">

### Author: ![system](https://community.zammad.org/uploads/default/original/1X/5c5afaea2d23f811dbec33cd4edb02fa29d3262f.png) [@system](https://community.zammad.org/u/system)
#### Post date: [July 11, 2024, 4:29pm UTC](https://community.zammad.org/t/geoip-not-works/11601/9 "2024-07-11T16:29:24Z")

</div>

This topic was automatically closed 360 days after the last reply. New replies are no longer allowed.
