Skip to content

Commit 99d33cc

Browse files
authored
Due with heroku proxy
1 parent f09ce06 commit 99d33cc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

mldictionary_api/routes/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def dictionary(word: str):
2727

2828
choice = request.url.split('/')[5]
2929
dictionary = DICTIONARIES[choice]
30-
request_ip = request.remote_addr
30+
request_ip = request.remote_addr if not request.headers.getlist("X-Forwarded-For") else request.headers.getlist("X-Forwarded-For")[0]
3131
total_requests = requests_db.get(f'requests:{request_ip}')
3232
if not (meanings := dictionary.get_meanings(word)):
3333
raise NotFound(f'"{word}" not found, check the spelling and try again')

0 commit comments

Comments
 (0)