2

I have to proxy a site which is hosted on an external webspace through my lighty on example.org. My config so far:

$HTTP["url"] =~ "^/webmail" {
    proxy.server =  ("/webmail/" => (
        # this entry should link to example2.org
        ("host" => "1.2.3.4", "port" => 80)
    ))
}

The webspace provider has configured my domain as vhost. So if i access http://1.2.3.4/webmail/ lighttpd will only deliver the main site of the webspace provider which says "Site example.org was not found on our server."

Any suggestions how i have to configure lighty to proxy sites that are only hosted as vhost (and do not have an ip on their own)?

0

I believe this can be fixed with mod_setenv:

$HTTP["url"] =~ "^/webmail" {
    # add host header
    setenv.add-request-header ( "Host" => "example2.org" )

    proxy.server =  ("/webmail/" => (
        # this entry should link to example2.org
        ("host" => "1.2.3.4", "port" => 80)
    ))
}
  • unfortunately that doesn't work. add-request-header just ADDs a header, so the request will contain "example.org, example2.org" as host header. There's an patch that enables set-request-header. That's not an option, I want to continue using the maintainers lighty version. Otherwise I'll have to patch my build by hand every time a security update gets released. – gorootde Sep 21 '11 at 17:30
  • Which version of Lighty do you use? – Vladimir Blaskov Sep 21 '11 at 20:19
  • I'am using Version 1.4.29 – gorootde Oct 4 '11 at 11:33
0

You need to get your hosting provider to support the X-Forwarded-Host header. Maybe it already works, try it. This can be readily added with built-in lighttpd capabilities.

proxy.forwarded = ( "host" => 1 )

enables it in your proxying server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.