Geolocation not working - IPs are not detected. #171
-
How Shlink is set-up
SummaryI was initially using an nginx reverse proxy in front of the shlink instance, but with that the geolocation feature did not work, I would get unknown everytime. So I decided to get rid of the reverse proxy and hit the shlink instance directly, but the geolocation still shows unknown, there is no problem with the geolite configs, the api-key works, the visit commands work. But the geolocation doesn't. I am not sure what I am doing wrong. Can someone point out ? Just for reference, here is my nginx config -
And my .env for the docker instance -
This is the response object for visits -
I am guessing the PS. This is an amazing project. Huge thanks @acelaya. Great Work!! |
Beta Was this translation helpful? Give feedback.
Replies: 0 comments 14 replies
-
Can you check the remote_addr column in the visits table in the database? Does it have any values? |
Beta Was this translation helpful? Give feedback.
-
It has this value - |
Beta Was this translation helpful? Give feedback.
-
If your remote_addr table is already populated with visitor IPs, the most likely cause is that you haven’t set the GEOLITE_LICENSE_KEY environment variable in your container. You can find the details in the docs here: Without a valid key (or if the shared key has hit its download limit), Shlink will be unable to geolocate visits, so all entries will show up as “Unknown.” |
Beta Was this translation helpful? Give feedback.
For those who are still facing the same issue, one way to solve it is by using
ngx_http_realip_module
which creates a new request that takes the actual user's IP and redirects it to Docker.in
/etc/nginx/nginx.conf
add:And inside your
sites-enabled
file, for example/etc/nginx/sites-enabled/myshortwebsite.com