Change remote_addr to using proxy

I need to use proxy (preferably mitmweb) to to get access to a restricted webpage. I am new to this and don’t know exactly what to do. Just adding a header with remote_addr : isn’t working.

The code which gives access -

if request.remote_addr != '':
            return abort(403)

Any help would be appreciated.