Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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)?

share|improve this question

1 Answer 1

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)
    ))
}
share|improve this answer
    
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. –  k_wave 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 –  k_wave Oct 4 '11 at 11:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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