mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-25 09:21:04 +00:00
Rate limit behind proxy
This commit is contained in:
parent
827fe227ce
commit
51adc564bb
1 changed files with 7 additions and 1 deletions
|
@ -1,8 +1,14 @@
|
|||
from flask import Flask, render_template, jsonify, request, abort, send_from_directory
|
||||
from flask_swagger import swagger
|
||||
from flask_swagger_ui import get_swaggerui_blueprint
|
||||
from flask_limiter.util import get_remote_address
|
||||
|
||||
def get_remote_address():
|
||||
if request.headers.getlist("X-Forwarded-For"):
|
||||
ip = request.headers.getlist("X-Forwarded-For")[0]
|
||||
else:
|
||||
ip = request.remote_addr or '127.0.0.1'
|
||||
|
||||
return ip
|
||||
|
||||
def create_app(char_limit=-1, req_limit=-1, ga_id=None, debug=False):
|
||||
from app.init import boot
|
||||
|
|
Loading…
Reference in a new issue