fix:更新获取IP的方式
This commit is contained in:
+2
-1
@@ -46,7 +46,8 @@ class IPRateLimit:
|
||||
self.ips.pop(ip)
|
||||
|
||||
def __call__(self, request: Request):
|
||||
ip = request.client.host
|
||||
ip = request.headers.get('X-Real-IP', request.headers.get('X-Forwarded-For', request.client.host))
|
||||
print(ip)
|
||||
if not self.check_ip(ip):
|
||||
raise HTTPException(status_code=400, detail=f"请求次数过多,请稍后再试")
|
||||
return ip
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<meta name="description" content="{{description}}"/>
|
||||
<meta name="keywords" content="{{keywords}}"/>
|
||||
<meta name="generator" content="FileCodeBox"/>
|
||||
<meta name="template" content="Lan-V1.5.4"/>
|
||||
<meta name="template" content="Lan-V1.5.5"/>
|
||||
<style>
|
||||
.qu .el-button {
|
||||
width: 100px;
|
||||
|
||||
Reference in New Issue
Block a user