-
-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GeoIP resolution fails to work when running GoatCounter without a reverse proxy #294
Comments
This should already be enabled by default. The GeoDB is compiled in the binary: https://github.com/zgoat/goatcounter/blob/master/pack/geodb.go I think you might not be forwarding the IP address correct if you're running stuff through a proxy? Try setting |
Thanks so much for the fast response! I see, I'm not doing any funny business, running it on a Google Cloud compute instance without any proxy or middleman software. I'll try from more IPs, maybe my ranges I tested from are simply not recognized by GeoIP's Country DB. |
I'm not really familiar with Google cloud, but if you add something like:
Over here: https://github.com/zgoat/goatcounter/blob/master/handlers/backend.go#L209 And recompile, you can check the output to see which IP address is being used, just to make sure that's correct. I'm reasonably sure this is your problem, but can never be 100% sure 😅 Should probably add a |
and https://www.maxmind.com/en/geoip-demo identifies the IP correctly, so I don't think it's that either. This change was made on the |
I think that port number in there may be the issue. If you do use a proxy then there won't be any port number I think, so I never noticed. Removing that should probably fix it. I'll take a look later. |
Looks like this is a reported issue already: go-chi/chi#453 |
Ah, I see! It seems like maybe using a proxy is the right way to go for now anyway. I also noticed that GoatCounter fails to successfully negotiate an ACME certificate unless I manually specify the listen address to 0.0.0.0 as well, a la Thanks again for the help :). |
Yeah, there's #285 for the acme thing. To be honest, my experience with implementing acme in GoatCounter has left me quite disappointed with the entire thing; there are so many assumptions with how you've set up your server that it completely breaks the "just run a dev server on :8080" (... and don't even get me started about wildcard certificates...) |
With Caddy being so easy to setup, maybe you could not need to maintain the ACME code from GoatCounter and instead recommend people self-hosting to use Caddy with an example Caddyfile? The configuration is literally just two lines to get it working with GoatCounter. And now country reporting works for me too! analytics.example.com
reverse_proxy http://localhost:8081 |
Yeah, but then you need to run Caddy, haha. Right now GoatCounter can run without any external dependencies (other than a place to store the SQLite database file – no way around that) which is a property I rather like. Also, Caddy has pretty much the same problems as GoatCounter; from memory it just refuses to run without root or The only reason I use hitch as a TLS proxy on goatcounter.com is because I run some other stuff on the server as well, but other than that there is no real reason to do so (no longer, anyway). Ideally, I'd like to simplify things a bit at some point but it's not a huge priority. |
Respect on the no-dependency philosophy. Yep, it's true things should work fine without Caddy and with a few small changes. I'll rename the title of this issue and keep it open, but feel free to close it if this is tracked elsewhere. Thanks again for your support and for making such a nice straightforward analytics project. |
It would be great to have a section in the README or somewhere else that explained how to enable location support in the self-hosted version of goatcounter.
Right now, all my visits using the binary from the releases tab here are showing "(unknown)" as the location, and the same thing happens if I drop my own
GeoLite2-Country.mmdb
into the root directory of goatcounter and do my own static build.The text was updated successfully, but these errors were encountered: