You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
450 B

  1. # -*- coding: utf-8 -*-
  2. # © 2015 Aserti Global Solutions
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from werkzeug.serving import WSGIRequestHandler
  5. def address_string(self):
  6. forwarded_for = self.headers.get('X-Forwarded-For', '').split(',')
  7. if forwarded_for and forwarded_for[0]:
  8. return forwarded_for[0]
  9. else:
  10. return self.client_address[0]
  11. WSGIRequestHandler.address_string = address_string