mirror of
https://github.com/Mailu/Mailu.git
synced 2024-12-14 10:53:30 +02:00
parent
0d2630c47b
commit
bca4fdffdb
@ -130,6 +130,7 @@ https://mailu.io/master/configuration.html#header-authentication-using-an-extern
|
||||
def _proxy():
|
||||
proxy_ip = flask.request.headers.get('X-Forwarded-By', flask.request.remote_addr)
|
||||
ip = ipaddress.ip_address(proxy_ip)
|
||||
client_ip = flask.request.headers.get('X-Real-IP', flask.request.remote_addr)
|
||||
if not any(ip in cidr for cidr in app.config['PROXY_AUTH_WHITELIST']):
|
||||
flask.current_app.logger.error(f'Login failed by proxy - not on whitelist: from {client_ip} through {flask.request.remote_addr}.')
|
||||
return flask.abort(500, '%s is not on PROXY_AUTH_WHITELIST' % proxy_ip)
|
||||
|
1
towncrier/newsfragments/3314.bugfix
Normal file
1
towncrier/newsfragments/3314.bugfix
Normal file
@ -0,0 +1 @@
|
||||
Define client_ip variable in _proxy method. Fixes server error when using proxy authentication
|
Loading…
Reference in New Issue
Block a user