-
Notifications
You must be signed in to change notification settings - Fork 852
Closed
Closed
Copy link
Labels
Description
hello !!
i want to set acl with geoip country.
so, i set header_rewrite plugin configurations about geo.
and i got always same response header below.
i tested this on browser
http://1.201.173.127/cat/cat1.jpg
header result is below.
ats-geo-asn: -1
ats-geo-asn-name: (unknown)
ats-geo-country: (unknown)
ats-geo-country-iso: -1
x-client-ip: 1.201.194.27
x-inbound-ip: 192.168.10.15
x-outbound-ip: 192.168.10.15
x-server-ip: 52.***.***.*** "masking"
my host ip is : 1.201.194.27
thus, expected header result is below
ats-geo-asn: Asia
ats-geo-asn-name: AS
ats-geo-country: South Korea
ats-geo-country-iso: KR
i checked mmdb file is correct
mmdblookup --file /opt/ts/etc/trafficserver/GeoLite2-City.mmdb --ip 1.201.194.27
{
"continent":
{
"code":
"AS" <utf8_string>
"geoname_id":
6255147 <uint32>
"names":
{
"de":
"Asien" <utf8_string>
"en":
"Asia" <utf8_string>
"es":
"Asia" <utf8_string>
"fr":
"Asie" <utf8_string>
"ja":
"アジア" <utf8_string>
"pt-BR":
"Ásia" <utf8_string>
"ru":
"Азия" <utf8_string>
"zh-CN":
"亚洲" <utf8_string>
}
}
"country":
{
"geoname_id":
1835841 <uint32>
"iso_code":
"KR" <utf8_string>
"names":
{
"de":
"Südkorea" <utf8_string>
"en":
"South Korea" <utf8_string>
"es":
"Corea del Sur" <utf8_string>
"fr":
"Corée du Sud" <utf8_string>
"ja":
"大韓民国" <utf8_string>
"pt-BR":
"Coreia do Sul" <utf8_string>
"ru":
"Республика Корея" <utf8_string>
"zh-CN":
"韩国" <utf8_string>
}
}
"location":
{
"accuracy_radius":
200 <uint16>
"latitude":
37.511200 <double>
"longitude":
126.974100 <double>
"time_zone":
"Asia/Seoul" <utf8_string>
}
"registered_country":
{
"geoname_id":
1835841 <uint32>
"iso_code":
"KR" <utf8_string>
"names":
{
"de":
"Südkorea" <utf8_string>
"en":
"South Korea" <utf8_string>
"es":
"Corea del Sur" <utf8_string>
"fr":
"Corée du Sud" <utf8_string>
"ja":
"大韓民国" <utf8_string>
"pt-BR":
"Coreia do Sul" <utf8_string>
"ru":
"Республика Корея" <utf8_string>
"zh-CN":
"韩国" <utf8_string>
}
}
}
my congurations are below
records.yaml
records:
http:
connect_attempts_max_retries: 3
cache:
http: 1
required_headers: 0
ignore_client_no_cache: 0
ignore_query: 1
server_ports: 80 80:ipv6 443:ssl
normalize_ae: 2
reverse_proxy:
enabled: 1
url_remap:
pristine_host_hdr: 0
remap_required: 1
log:
logging_enabled: 3
logfile_dir: var/log/trafficserver
rolling_enabled: 1
rolling_interval_sec: 300
rolling_allow_empty: 1
rolling_max_count: 10
ssl:
client:
version:
min: 2
max: 3
certification_level: 1
verify:
server:
policy: PERMISSIVE
server:
multicert:
exit_on_load_fail: 0
cert:
path: /opt/ts/etc/trafficserver/ssl
private_key:
path: /opt/ts/etc/trafficserver/ssl
diags:
debug:
enabled: 1
output:
logfile_perm: rwxrwxrwx
logfile:
name: traffic.out
rolling_enabled: 2
rolling_size_mb: 500
rolling_min_count: 2
remap.config
** even i set
map http://1.201.173.127 https://jinyong-test-3.s3.ap-northeast-2.amazonaws.com @plugin=compress.so @pparam=compress.config @plugin=header_rewrite.so @pparam=svc/test2222.kinxzone.com/header_rewrite.conf @plugin=conf_remap.so @pparam=svc/test2222.kinxzone.com/conf_remap.yaml
** this point, i did this setting as well but does not work
........... @plugin=header_rewrite.so @pparam=--geo-db-path=/opt/ts/etc/trafficserver/GeoLite2-City.mmdb @pparam=svc/test2222.kinxzone.com/header_rewrite.conf ...................
plugin.config
header_rewrite.so --geo-db-path=/opt/ts/etc/trafficserver/GeoLite2-City.mmdb
svc/test2222.kinxzone.com/header_rewrite.conf
cond %{REMAP_PSEUDO_HOOK}
set-header X-Kinx-Cdn "LOCAL"
cond %{SEND_REQUEST_HDR_HOOK}
set-header X-Kinx-Cdn "LOCAL"
cond %{READ_RESPONSE_HDR_HOOK} [AND]
cond %{HEADER:Cache-Control} ="" [AND]
cond %{STATUS} >199 [AND]
cond %{STATUS} <400
set-header Cache-Control "max-age=22, public"
cond %{SEND_REQUEST_HDR_HOOK}
set-header Host %{CLIENT-HEADER:Host}
set-header User-Agent %{CLIENT-HEADER:User-Agent}
cond %{SEND_RESPONSE_HDR_HOOK}
set-header name1234 "1234"
set-header name5555 "5555"
cond %{REMAP_PSEUDO_HOOK} [AND]
cond %{HEADER:Content-Type} ="image/bmp" [OR]
cond %{HEADER:Content-Type} ="image/jpeg" [OR]
cond %{HEADER:Content-Type} ="image/gif" [OR]
cond %{HEADER:Content-Type} ="image/png" [OR]
cond %{HEADER:Content-Type} ="video/x-msvideo"
set-header Cache-Control "no-cache"
cond %{SEND_REQUEST_HDR_HOOK}
rm-header Cache-Control
cond %{SEND_RESPONSE_HDR_HOOK}
set-header ATS-Geo-Country %{GEO:COUNTRY}
set-header ATS-Geo-Country-ISO %{GEO:COUNTRY-ISO}
set-header ATS-Geo-ASN %{GEO:ASN}
set-header ATS-Geo-ASN-NAME %{GEO:ASN-NAME}
set-header X-Client-IP %{IP:CLIENT}
set-header X-Inbound-IP %{IP:INBOUND}
set-header X-Server-IP %{IP:SERVER}
set-header X-Outbound-IP %{IP:OUTBOUND}
maybe ATS 10.0.0 does not load mmdb file at all.
please give me any information !
@bneradt @calavera @janfrode @biilmann @jpeach @sekimura @cmcfarlen @bryancall @mlibbey @brbzull0
thanks a lot !
Reactions are currently unavailable