Geoip Placeholders

geoip has some placeholders available. So we can use {geoip_city_name} {geoip_country_name} etc…
But now I want specify state name like California. How can I add this one: {geoip_state_name}
thanks for help me again

Ultimately this depends on whether the Maxmind database has this information available. After a quick search, I could only find references to City and Country information on their website. If it doesn’t, you’ll need to use the information that is available to make guesses somehow.

That said, the code that sets the placeholders is here:

caddy-geoip/setup.go at 084ac7fec1b9422940d3687b449ce0bd7de7b758 · aablinov/caddy-geoip · GitHub

To add that placeholder, you would need to alter this to add the appropriate information and recompile with the updated plugin.

I answered here: tried to add geoip_state_name · Issue #11 · aablinov/caddy-geoip · GitHub

It isn’t currently available with this plugin as of today. Plugin owner is still actively maintaining it, so maybe it’ll be added.

1 Like

great help. thanks

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