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

I'm really just starting out with lighttpd and I'm not sure how to configure this exactly.

I'm wanting to take traffic and redirect to another server say "http://localhost/url_a/" and redirect the request and responses from that to "http://other_server:8080/"

Another example would be "http://localhost/url_b/" going to "http://other_server:8081/url_b/"

What exactly should I look into for accomplishing this?

Thanks.

share|improve this question
3  
Do you want a redirect (i.e. send the client to the other location), or do you want to proxy (Lighttpd connects to the other location and sends the response to the client)? –  mgorven Oct 23 '12 at 17:56
    
I'd like more of a proxy. –  daelious Oct 23 '12 at 18:16

1 Answer 1

In Lighttpd 1.4 you need to use mod_proxy to forward the request to another server.

proxy.server = ("/url_a" => ((
    "host" => "1.2.3.4",
    "port" => 8080,
)))

Changing the URL path or virtual hostname is a bit tricky in 1.4. If you're using 1.5 you can use mod_proxy_core instead, which is more configurable:

$HTTP["url"] =~ "^/url_a" {
    proxy-core.protocol = "http"
    proxy-core.backends = ("other_server:8080")
    proxy-core.rewrite-request = (
        "_uri" => ( "^/url_a/?(.*)" => "/$1" ),
        "Host" => ( ".*" => "other_server" ),
    )
}
share|improve this answer
    
I'm currently limited to using only 1.4. Since 1.5 isn't compiling very well. –  daelious Oct 24 '12 at 16:56

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.