Project

General

Profile

[Solved] ModProxy: Add X-ServerAddr header

Added by niko.d over 9 years ago

Hello!

I'm running lighttpd 1.4.35 on a linux box with multiple interfaces/multiple IP addresses and use mod_proxy to proxy several prefixes to a single server on the same system:

i.e.:

proxy.server = (  "/sub1" =>                                         
                  ( "sub1_name" =>                   
                    (                             
                      "host" => "127.0.0.1",      
                      "port" => 1234
                    )                             
                  ),
                  ...
           )

In the server application I need to be able to distinguish from which interface/IP address the request was received/forwarded. Is it possible to add a custom header (e.g. X-ServerAddr) to the request, containing the address of the incoming interface (similiar to the SERVER_ADDR environment variable in mod_fastcgi) - preferrably without patching lighttpd?

Thank you for your help!


Replies (1)

RE: [Solved] ModProxy: Add X-ServerAddr header - Added by gstrauss about 7 years ago

The upcoming lighttpd 1.4.46 will support RFC7239 Forwarded header, and you can enable inclusion of by=... to forward the server IP on which the request was received. See Docs_ModProxy

    (1-1/1)