1. Output of caddy version
:
v2.5.2 h1:eCJdLyEyAGzuQTa5Mh3gETnYWDClo1LjtQm2q9RNZrs=
2. How I run Caddy:
a. System environment:
Ubuntu 22.04 LTS
b. Command:
c. Service/unit/compose file:
NA
d. My complete Caddy config:
{
"admin": {
"enforce_origin": true,
"listen": "",
"origins": [
"REDACTED"
]
},
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":80"
],
"routes": [
{
"handle": [
{
"account_id": 0,
"api_key": "",
"db_path": "/etc/caddy/GeoLite2-Country.mmdb",
"download_frequency": 0,
"handler": "geoip",
"override_country_code": "",
"reload_frequency": 0,
"trust_header": "X-Real-IP"
}
]
},
{
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"body": "Hello from {geoip.country_code}",
"handler": "static_response"
}
]
}
]
}
],
"match": [
{
"host": [
"REDACTED"
]
}
],
"terminal": true
}
]
},
"srv1": {
"listen": [
":443"
],
"routes": [
{
"handle": [
{
"handler": "reverse_proxy",
"headers": {
"request": {
"set": {
"Country": [
"{geoip.country_code}"
]
}
},
"response": {
"set": {
"Country": [
"{geoip.country_code}"
]
}
}
},
"transport": {
"protocol": "http",
"tls": {}
},
"upstreams": [
{
"dial": "REDACTED"
}
]
}
]
}
],
"tls_connection_policies": [
{}
]
}
}
},
"tls": {
"automation": {
"on_demand": {
"ask": "REDACTED"
},
"policies": [
{
"issuers": [],
"on_demand": true
}
]
}
}
}
}
3. The problem I’m having:
I’ve set up the GeoIP plugin (GitHub - shift72/caddy-geo-ip: Implements a Geo IP Lookup using the Maxmind IP Database) via the caddy download page and it works correctly.
I’m unable to add the country code to the header, it outputs the placeholder {geoip.country_code}
literally.
4. Error messages and/or full log output:
NA
5. What I already tried:
I’ve read the docs extensively and part of the codebase and have gone through multiple posts about this