feat: add EdgeOne X-Origin-Token validation

This commit is contained in:
lingkai5wu committed 2026-09-21 23:58:08 +08:00
1 parent 8edc218dbf
commit adcdf6e8c8
7 files changed
+27 -10

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
map_hash_bucket_size 128;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
geo $is_internal {
default 0;
172.30.0.1 1;
192.168.10.0/24 1;
}
map $http_x_origin_token $valid_origin_token {
default 0;
${EO_ORIGIN_TOKEN} 1;
}
map $is_internal$valid_origin_token $allow_access {
default 0;
10 1;
01 1;
}
@@ -15,8 +15,3 @@ server {
return 404; return 404;
} }
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
-1
View File
@@ -5,7 +5,6 @@ server {
server_name adguard.${BASE_DOMAIN}; server_name adguard.${BASE_DOMAIN};
include snippets/proxy.conf; include snippets/proxy.conf;
include snippets/internal-only.conf;
location / { location / {
proxy_pass http://adguardhome; proxy_pass http://adguardhome;
-1
View File
@@ -5,7 +5,6 @@ server {
server_name backrest.${BASE_DOMAIN}; server_name backrest.${BASE_DOMAIN};
include snippets/proxy.conf; include snippets/proxy.conf;
include snippets/internal-only.conf;
location / { location / {
proxy_pass http://backrest:9898; proxy_pass http://backrest:9898;
-1
View File
@@ -5,7 +5,6 @@ server {
server_name qbt.${BASE_DOMAIN}; server_name qbt.${BASE_DOMAIN};
include snippets/proxy.conf; include snippets/proxy.conf;
include snippets/internal-only.conf;
location / { location / {
proxy_pass http://qbittorrent:8080; proxy_pass http://qbittorrent:8080;
-2
View File
@@ -1,2 +0,0 @@
allow 192.168.10.0/24;
deny all;
+4
View File
@@ -1,3 +1,7 @@
if ($allow_access = 0) {
return 403;
}
# set headers # set headers
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;