Repository navigation
Expand file tree
/
Copy pathingress-nginx-configmap.yaml
More file actions
70 lines (64 loc) · 2.41 KB
/
Copy pathingress-nginx-configmap.yaml
File metadata and controls
70 lines (64 loc) · 2.41 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
apiVersion: v1
kind: ConfigMap
metadata:
name: ingress-nginx-controller
namespace: ogcapi
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.10.1
data:
enable-real-ip: "true"
forwarded-for-header: "CF-Connecting-IP"
proxy-real-ip-cidr: "173.245.48.0/20,103.21.244.0/22,103.22.200.0/22,103.31.4.0/22,141.101.64.0/18,108.162.192.0/18,190.93.240.0/20,188.114.96.0/20,197.234.240.0/22,198.41.128.0/17,162.158.0.0/15,104.16.0.0/13,104.24.0.0/14,172.64.0.0/13,131.0.72.0/22,2400:cb00::/32,2606:4700::/32,2803:f800::/32,2405:b500::/32,2405:8100::/32,2a06:98c0::/29,2c0f:f248::/32"
use-http2: "false"
allow-snippet-annotations: "false"
limit-req-status-code: "429"
limit-conn-status-code: "429"
block-user-agents: "~*meta-webindexer.*,~*meta-externalagent.*"
http-snippet: |
map $arg_offset $deep_offset {
default 0;
"~^[0-9]{4,}$" 1;
}
# Trusted referer (origin-only referers like https://host/ also match)
map $http_referer $referer_trusted {
default 0;
"~*^https?://mapaspt\.dgterritorio\.gov\.pt(/|$)" 1;
}
# Replaces the limit-allowlist annotation (uses the real IP from CF-Connecting-IP)
geo $ip_allowed {
default 0;
192.168.2.0/24 1;
51.21.193.251/32 1;
79.168.93.61/32 1;
}
map "$referer_trusted$ip_allowed" $exempt {
"00" 0;
default 1;
}
map $uri $is_tile {
default 0;
"~^/collections/[^/]+/tiles/" 1;
}
# Empty key = request is not counted against that zone
map "$exempt$is_tile" $strict_key {
"00" $binary_remote_addr;
default "";
}
map "$exempt$is_tile" $tile_key {
"01" $binary_remote_addr;
default "";
}
limit_req_zone $strict_key zone=ogc_strict:10m rate=5r/s;
limit_req_zone $tile_key zone=ogc_tiles:10m rate=50r/s;
limit_conn_zone $strict_key zone=ogc_strict_conn:10m;
limit_conn_zone $tile_key zone=ogc_tiles_conn:10m;
location-snippet: |
if ($deep_offset) { return 429; }
limit_req zone=ogc_strict burst=15 nodelay;
limit_req zone=ogc_tiles burst=250 nodelay;
limit_conn ogc_strict_conn 5;
limit_conn ogc_tiles_conn 30;