geo.{$SUBDOMAIN}.{$DOMAIN} {
	log {
		output file /var/log/geo.log
	}

	geoip2_vars wild
	# strict: Alway ignore 'X-Forwarded-For' header
	# wild:   Trust 'X-Forwarded-For' header_up if existed
	# trusted_proxies: Trust 'X-Forwarded-For' header_up if trusted_proxies is also valid (see https://caddyserver.com/docs/caddyfile/options#trusted-proxies)
	# default: trusted_proxies

	@geofilter expression ({geoip2.country_code} != "FR")

	route @geofilter {
		reverse_proxy host:12345 {
			header_up X-Real-IP {remote_host}
			header_up X-Geo-Ip-Address "{geoip2.ip_address}"
			header_up X-Geo-Country-Code "{geoip2.country_code}"
			header_up X-Geo-Country-Name "{geoip2.country_name}"
			header_up X-Geo-Country-Eu "{geoip2.country_eu}"
			header_up X-Geo-Country-Locales "{geoip2.country_locales}"
			header_up X-Geo-Country-Confidence "{geoip2.country_confidence}"
			header_up X-Geo-Country-Names "{geoip2.country_names}"
			header_up X-Geo-Country-Geoname-Id "{geoip2.country_geoname_id}"
			header_up X-Geo-Continent-Code "{geoip2.continent_code}"
			header_up X-Geo-Continent-Locales "{geoip2.continent_locales}"
			header_up X-Geo-Continent-Names "{geoip2.continent_names}"
			header_up X-Geo-Continent-Geoname-Id "{geoip2.continent_geoname_id}"
			header_up X-Geo-Continent-Name "{geoip2.continent_name}"
			header_up X-Geo-City-Confidence "{geoip2.city_confidence}"
			header_up X-Geo-City-Locales "{geoip2.city_locales}"
			header_up X-Geo-City-Names "{geoip2.city_names}"
			header_up X-Geo-City-Geoname-Id "{geoip2.city_geoname_id}"
			header_up X-Geo-City-Name "{geoip2.city_name}"
			header_up X-Geo-Location-Latitude "{geoip2.location_latitude}"
			header_up X-Geo-Location-Longitude "{geoip2.location_longitude}"
			header_up X-Geo-Location-Time-Zone "{geoip2.location_time_zone}"
			header_up X-Geo-Location-Accuracy-Radius "{geoip2.location_accuracy_radius}"
			header_up X-Geo-Location-Average-Income "{geoip2.location_average_income}"
			header_up X-Geo-Location-Metro-Code "{geoip2.location_metro_code}"
			header_up X-Geo-Location-Population-Density "{geoip2.location_population_density}"
			header_up X-Geo-Postal-Code "{geoip2.postal_code}"
			header_up X-Geo-Postal-Confidence "{geoip2.postal_confidence}"
			header_up X-Geo-Registeredcountry-Geoname-Id "{geoip2.registeredcountry_geoname_id}"
			header_up X-Geo-Registeredcountry-Is-In-European-Union "{geoip2.registeredcountry_is_in_european_union}"
			header_up X-Geo-Registeredcountry-Iso-Code "{geoip2.registeredcountry_iso_code}"
			header_up X-Geo-Registeredcountry-Names "{geoip2.registeredcountry_names}"
			header_up X-Geo-Registeredcountry-Name "{geoip2.registeredcountry_name}"
			header_up X-Geo-RepresentedCountry-Geoname-Id "{geoip2.representedcountry_geoname_id}"
			header_up X-Geo-RepresentedCountry-Is-In-European-Union "{geoip2.representedcountry_is_in_european_union}"
			header_up X-Geo-RepresentedCountry-Iso-Code "{geoip2.representedcountry_iso_code}"
			header_up X-Geo-RepresentedCountry-Names "{geoip2.representedcountry_names}"
			header_up X-Geo-RepresentedCountry-Locales "{geoip2.representedcountry_locales}"
			header_up X-Geo-RepresentedCountry-Confidence "{geoip2.representedcountry_confidence}"
			header_up X-Geo-RepresentedCountry-Type "{geoip2.representedcountry_type}"
			header_up X-Geo-RepresentedCountry-Name "{geoip2.representedcountry_name}"
			header_up X-Geo-Traits-Is-Anonymous-Proxy "{geoip2.traits_is_anonymous_proxy}"
			header_up X-Geo-Traits-Is-Anonymous-Vpn "{geoip2.traits_is_anonymous_vpn}"
			header_up X-Geo-Traits-Is-Satellite-Provider "{geoip2.traits_is_satellite_provider}"
			header_up X-Geo-Traits-Autonomous-System-Number "{geoip2.traits_autonomous_system_number}"
			header_up X-Geo-Traits-Autonomous-System-Organization "{geoip2.traits_autonomous_system_organization}"
			header_up X-Geo-Traits-Connection-Type "{geoip2.traits_connection_type}"
			header_up X-Geo-Traits-Domain "{geoip2.traits_domain}"
			header_up X-Geo-Traits-Is-Hosting-Provider "{geoip2.traits_is_hosting_provider}"
			header_up X-Geo-Traits-Is-Legitimate-Proxy "{geoip2.traits_is_legitimate_proxy}"
			header_up X-Geo-Traits-Is-Public-Proxy "{geoip2.traits_is_public_proxy}"
			header_up X-Geo-Traits-Is-Residential-Proxy "{geoip2.traits_is_residential_proxy}"
			header_up X-Geo-Traits-Is-Tor-Exit-Node "{geoip2.traits_is_tor_exit_node}"
			header_up X-Geo-Traits-Isp "{geoip2.traits_isp}"
			header_up X-Geo-Traits-Mobile-Country-Code "{geoip2.traits_mobile_country_code}"
			header_up X-Geo-Traits-Mobile-Network-Code "{geoip2.traits_mobile_network_code}"
			header_up X-Geo-Traits-Network "{geoip2.traits_network}"
			header_up X-Geo-Traits-Organization "{geoip2.traits_organization}"
			header_up X-Geo-Traits-User-Type "{geoip2.traits_user_type}"
			header_up X-Geo-Traits-User-Count "{geoip2.traits_userCount}"
			header_up X-Geo-Traits-Static-Ip-Score "{geoip2.traits_static_ip_score}"
		}
	}
}
