[MapProxy] mapproxy behind a reverse proxy and use of X-Script-Name

Oliver Tonnhofer olt at omniscale.de
Wed Apr 10 01:24:59 PDT 2013


Hi Anne,

On 05.04.2013, at 18:04, Anne Blankert wrote:
> I've created support for a new reverse proxy header "X-Forwarded-Path" (source code changes described below).
[...]

Cool. Can you make a pull request for the changes? Maybe with a few tests for resource_url?


> To make this work, the following source changes were applied to MapProxy version 1.5:
> 
> 4 files, base directory: /usr/local/lib/python2.7/dist-packages/mapproxy/
> 
> file 1: request/base.py, add new method to class Request(object)
> 
>    @property
>    def resource_url(self):
>        forwarded_path = self.environ.get('HTTP_X_FORWARDED_PATH')
>        if forwarded_path:
>            path_info = self.environ.get('PATH_INFO')
>            pos = path_info.rfind('tms')
>            if pos >= 0:
>               path_info = path_info[pos+3:]
>            else:
>               path_info = ''

Can you explain what this does/why this is necessary? 

Regards,
Oliver

-- 
Oliver Tonnhofer    | Omniscale GmbH & Co KG    | http://omniscale.com
http://mapproxy.org | https://github.com/olt    | @oltonn









More information about the MapProxy mailing list