Skip to content

Commit b6a7803

Browse files
authored
Merge pull request #384 from OperationCode/fix-rate-limiting
Add ProxyFix to rate limiting
2 parents ba92213 + f666602 commit b6a7803

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

app/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
from flask_sqlalchemy import SQLAlchemy
77
from flask_limiter import Limiter
88
from flask_limiter.util import get_remote_address
9+
from werkzeug.middleware.proxy_fix import ProxyFix
10+
from os import environ
911

1012
from healthcheck import HealthCheck
1113
# from healthcheck import EnvironmentDump
@@ -23,6 +25,8 @@
2325
app.config.from_object(Config)
2426
app.url_map.strict_slashes = False
2527

28+
if environ['FLASK_ENV'] != 'development':
29+
app = ProxyFix(app, x_for=1, x_host=1)
2630
limiter = Limiter(
2731
app,
2832
key_func=get_remote_address,

0 commit comments

Comments
 (0)