Navigation Menu

Skip to content

Commit

Permalink
Pass the real IP
Browse files Browse the repository at this point in the history
Bug: T205087
Change-Id: I5f74c0221477b7bbc2bb6c3a200308218595a83a
  • Loading branch information
Ladsgroup committed Sep 21, 2018
1 parent 0ee85a3 commit 5f8fe71
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ores/wsgi/util.py
Expand Up @@ -95,12 +95,18 @@ def build_score_request(scoring_system, request, context_name=None, rev_id=None,
if context_name and context_name in scoring_system and not model_names:
model_names = scoring_system[context_name].keys()

# WMF specific solution
if request.headers.get('X-Client-IP') is None:
ip = request.remote_addr.strip()
else:
ip = request.headers['X-Client-IP'].strip()

return ScoreRequest(context_name, rev_ids, model_names,
precache=precache,
include_features=include_features,
injection_caches=injection_caches,
model_info=model_info,
ip=request.remote_addr.strip())
ip=ip)


def parse_rev_ids(request, rev_id):
Expand Down

0 comments on commit 5f8fe71

Please sign in to comment.