![]() | 1 HUZHUANGZHUANG 84 天前 api 应该是通过域名来访问的吧?把域名托管到 CF,在安全工具那里可以通过区域来禁止访问的。你试试这样有没有效果。 |
2 happyxhw101 84 天前 如果用的是 nginx 代理,可以这么干 1. nginx 配置 geo-ip ``` load_module "modules/ngx_http_geoip_module.so"; load_module "modules/ngx_stream_geoip_module.so"; ``` 2. 映射国家 code ``` map $geoip_country_code $allowed_country { default yes; CN yes; } map $remote_addr $allowed { default $allowed_country; 127.0.0.1 yes; ~^192\.168\.\\d+\.\\d+$ yes; ~^192\.167\.0\.\\d+$ yes; ~^192\.166\.1\.\\d+$ yes; } ``` 3. 判断 allowed ``` server { listen 443 ssl; if ($allowed != yes) { return 404; } } ``` |
3 happyxhw101 84 天前 |
4 happyxhw101 84 天前 tcp 也是可以的,用 nginx 的 stream, 比如代理 ssh ``` map $allowed $ssh_server { yes ssh; } upstream ssh { server 192.168.5.1:12345; } server { listen 2345; listen [::]:2345; proxy_pass $ssh_server; proxy_connect_timeout 30s; proxy_timeout 60s; ssl_preread on; } ``` |
![]() | 5 BeforeTooLate 84 天前 dns 解析的时候,直接把境外地址 CNAME 到 google.com |
6 SoulFlame OP @HUZHUANGZHUANG #1 域名在阿里管理,不方便托管到 CF |
7 SoulFlame OP @BeforeTooLate #5 请问在哪里设置,我域名在阿里 |
8 SoulFlame OP @happyxhw101 #2 请问这个原理是不是通过别人维护的 ip 名单实现的啊? |
![]() | 9 BeforeTooLate 84 天前 ![]() @SoulFlame 阿里云解析请求来源这个部分可以选择境外这个选项吧,具体我不太清楚这样是否有用 |
10 SoulFlame OP @BeforeTooLate #9 非常感谢,我上去看了,阿里 DNS 解析 请求来源是有地域设置,可以选中国 |