-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgeocdn.conf
48 lines (36 loc) · 1.07 KB
/
geocdn.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# configuration tested on
# nginx version: nginx/1.2.8
# built by gcc 4.4.5 (Debian 4.4.5-8)
# configure arguments: --with-ipv6 --with-http_geoip_module
geoip_org /etc/nginx/geocdn/GeoIPASNumv6.dat;
geoip_country /etc/nginx/geocdn/GeoIPv6.dat;
geoip_proxy 193.206.139.32/28;
geoip_proxy 193.206.140.32/28;
# extract only AS number from $geoip_org
map $geoip_org $my_geoip_org {
~^(?P<ascode>AS[0-9]+)\ .*$ $ascode;
}
# map ASes to sites
map $my_geoip_org $cdn_site {
default cdn;
include /etc/nginx/geocdn/as-to-site.conf;
}
# distinguish Client from Proxy
geo $frontend {
default C;
193.206.139.32/28 P;
193.206.140.32/28 P;
}
#add_header X-AS $my_geoip_org;
#add_header X-Country $geoip_country_code;
# do the actual redirections
map $request_uri $uri_for_redirection {
default $request_uri;
include /etc/nginx/geocdn/redirections.conf;
}
### put these lines in server { ... } block
#set $redirect_to_cdn "$frontend$uri_for_redirection";
#if ($redirect_to_cdn ~ "^COK" ) {
# rewrite ^ http://$cdn_site.mirror.garr.it/mirror2$request_uri
# break;
#}