Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLOBAL_WEB_RATE_LIMIT和GLOBAL_API_RATE_LIMIT功能可以关闭么 #1413

Open
5 tasks
monlor opened this issue May 7, 2024 · 4 comments
Open
5 tasks

GLOBAL_WEB_RATE_LIMIT和GLOBAL_API_RATE_LIMIT功能可以关闭么 #1413

monlor opened this issue May 7, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@monlor
Copy link

monlor commented May 7, 2024

例行检查

  • 我已确认目前没有类似 issue
  • 我已确认我已升级到最新版本
  • 我已完整查看过项目 README,已确定现有版本无法满足需求
  • 我理解并愿意跟进此 issue,协助测试和提供反馈
  • 我理解并认可上述内容,并理解项目维护者精力有限,不遵循规则的 issue 可能会被无视或直接关闭

功能描述

我用cf代理的,系统识别的ip是错误的,我想关闭这个功能,直接通过cf的自带的限流来实现就好了

应用场景

@monlor monlor added the enhancement New feature or request label May 7, 2024
@TimchaStudio
Copy link

TimchaStudio commented May 19, 2024

你试试下面配置,选择在全局 http 级别,单个 server 级别,或特定 location 级别添加下面配置,看是否可行。

# 设置信任 Cloudflare 的 IP 地址
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 104.16.0.0/12;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 131.0.72.0/22;
# 添加 IPv6 地址段,如果适用
# 如: set_real_ip_from 2400:cb00::/32;

# 指定 HTTP 头部中包含原始 IP 地址的字段
real_ip_header CF-Connecting-IP;  # 或者 real_ip_header X-Forwarded-For;

@songquanpeng
Copy link
Owner

这两个设置只针对前端页面请求和 api 请求

@monlor
Copy link
Author

monlor commented May 21, 2024

这两个设置只针对前端页面请求和 api 请求

可以加一个关闭的选项么,比如设置0就不开启限速

@monlor
Copy link
Author

monlor commented May 21, 2024

你试试下面配置,选择在全局 http 级别,单个 server 级别,或特定 location 级别添加下面配置,看是否可行。

# 设置信任 Cloudflare 的 IP 地址
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 104.16.0.0/12;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 131.0.72.0/22;
# 添加 IPv6 地址段,如果适用
# 如: set_real_ip_from 2400:cb00::/32;

# 指定 HTTP 头部中包含原始 IP 地址的字段
real_ip_header CF-Connecting-IP;  # 或者 real_ip_header X-Forwarded-For;

好像有点问题,CF-Connecting-IP是客户端的ip,如果将客户端ip设置为真实ip,nginx的白名单限制cf来源会失效。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants