Lighttpd Proxy

December 28th, 2005

Anyone else run into this problem using proxy.server with Lighttpd?

My goal is to have a Lighttpd process listening on port 80, which will then route requests for my websites to other Lighttpd processes running on different ports. I know this is easy with Apache and mod_proxy, but I’m trying to cut out Apache and use only Lighttpd. Here are two examples of how it’s done with Apache.

A pure Lighttpd setup seems easy enough, according to the documentation. I actually got it to work to a certain extent. Here’s what I did:

1. Set up a file for the listener on port 80. I called mine lighttpd_proxy.conf. I set it up like a normal lighttpd config file, but instead of my application’s configuration, I put this:


$HTTP["host"] =~ "www\.artofmission\.(com|net|org)" {
  proxy.server = (
    "" => (
      "artofmission" => (
        "host" => "127.0.0.1",
        "port" => 8080
      )
    )
  )
}

2. Then I set up another file called lighttpd_artofmission.conf, which contains the standard Ruby on Rails configuration for a Typo blog. This file I set up like a normal lighttpd configuration file, except that I changed the port from 80 to 8080 server.port = 8080.

So now, when I navigate to artofmission.com, the server actually proxies my request over to port 8080, and then reverse proxies the response back to my browser. Sweet! It works!

Except for one thing. Whenever I submit a form, it redirects the browser directly to port 8080. This is bad because now the URL reveals the port, and the request is no longer going through port 80.

So, anyone else experienced this problem? I’m about to go back to an Apache configuration if I can’t get this to work. Any input would be appreciated!


1 Response to “Lighttpd Proxy”

  1. Ryan Heneise Says:
    *Update:* "Here's a movie that describes what I'm experiencing":https://artofmission.com/files/lighttpd_proxy.mov

Sorry, comments are closed for this article.