[mod_python] Problem with mod_proxy + inputfilter + headers_in

indyone ;o) indyone at gmail.com
Thu Apr 19 11:21:05 EDT 2007


Hi list,

I'm trying to get the headers_in from the client, and after changing/adding
some headers i would like to pass them to the backend server.
I'm using Apache/2.0.55 (Win32) mod_python/3.1.3 Python/2.3.5
The problem is that the headers are sent to the backend unchanged when using
this simple input filter:

def inputfilter(filter):

    filter.req.headers_in['X-MyHeader'] = 'Test'
    if filter.req.main is not None:
        filter.pass_on()
        return

    filter.req.log_error('Start %s' % filter.req.uri)
    s = filter.read()
    while s:
        filter.write(s)
        s = filter.read()
    if s is None:
        filter.close()
        filter.req.log_error('End %s' % filter.req.uri)

    filter.req.log_error('%s' % filter.req.headers_in)

and Apache logs:

[Thu Apr 19 18:17:28 2007] [error] [client 127.0.0.1] Start /, referer:
http://localhost/
[Thu Apr 19 18:17:28 2007] [error] [client 127.0.0.1] End /, referer:
http://localhost/
[Thu Apr 19 18:17:28 2007] [error] [client 127.0.0.1] {'X-MyHeader': 'Test',
'X-Forwarded-Server': 'luna', 'X-Forwarded-Host': 'localhost',
'X-Forwarded-For': '127.0.0.1', 'Max-Forwards': '10', 'Cookie': 'wstyle=;
__ac="YWRtaW46bWF0cml4";
tree-s="eJzT0MgpMOQKVneEAKcAN19bda4CI67EkgJjLj0AegYHmA"', 'Referer': '
http://localhost/', 'Accept-Charset': 'ISO-8859-7,utf-8;q=0.7,*;q=0.7',
'Accept-Encoding': 'gzip,deflate', 'Accept-Language': 'el,en-us;q=0.7,en;q=
0.3', 'Accept': 'text/xml,application/xml,application/xhtml+xml,text/html;q=
0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'User-Agent': 'Mozilla/5.0
(Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8) Gecko/20061030
SeaMonkey/1.0.6', 'Host': 'localhost'}, referer: http://localhost/
...(multiple times)...

Which is right i think... But my backend server gets this request:

GET /VirtualHostBase/http/localhost:80/Editorial/VirtualHostRoot/ HTTP/1.1
Host: localhost:8081
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8)
Gecko/20061030 SeaMonkey/1.0.6
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9
,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: el,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-7,utf-8;q=0.7,*;q=0.7
Referer: http://localhost/
Cookie: wstyle=; __ac="YWRtaW46bWF0cml4";
tree-s="eJzT0MgpMOQKVneEAKcAN19bda4CI67EkgJjLj0AegYHmA"
Max-Forwards: 10
X-Forwarded-For: 127.0.0.1
X-Forwarded-Host: localhost
X-Forwarded-Server: luna

Thank you in advance,

Ioannis Stavrinos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20070419/bb5876e0/attachment.html


More information about the Mod_python mailing list