feat: add trusted client IP support for multiple gateways

This commit is contained in:
lingkai5wu committed 2026-09-22 17:08:25 +08:00
1 parent 9ad36c999c
commit 4e17dfc9c9
2 files changed
+35 -9

No files matched your search

+29 -7
View File
@@ -11,13 +11,35 @@ geo $is_internal {
192.168.10.0/24 1;
}
map $http_x_origin_token $valid_origin_token {
default 0;
${EO_ORIGIN_TOKEN} 1;
map $http_x_origin_token $gateway_provider {
default '';
${EO_ORIGIN_TOKEN} edgeone;
}
map $is_internal$valid_origin_token $allow_access {
default 0;
10 1;
01 1;
map $gateway_provider $gateway_client_ip {
default '';
edgeone $http_eo_connecting_ip;
}
map $gateway_client_ip $valid_gateway_client_ip {
default 0;
~^[0-9A-Fa-f:.]+$ 1;
}
map $is_internal:$gateway_provider:$valid_gateway_client_ip $access_source {
default denied;
~^1: internal;
0:edgeone:1 edgeone;
}
map $access_source $allow_access {
default 0;
internal 1;
edgeone 1;
}
map $access_source $trusted_client_ip {
default $remote_addr;
internal $remote_addr;
edgeone $gateway_client_ip;
}