trusted_proxies = '42.42.42.42', '82.42.82.42', '127.0.0.1'

def limit_remote_addr():
    remote = request.remote_addr
route = list(request.access_route)
while remote in trusted_proxies:
    remote = route.pop()
if remote != '10.20.30.40':
    abort(403)
How to limit Flask dev server to only one visiting ip address