Proxying Traffic with Lighttpd

Lighttpd logoI lately had an issue where I had a Web service running on a port other than 80 and obviously I couldn't have 2 daemons listening on port 80. So, I came up with a nice little alternative: Create a subdomain and configure lighttpd to proxy the traffic. An extra perk to it is that since the domain has a wildcard SSL certificate installed, the subproxy can share in the SSL goodness without any extra configuraion.

server.modules += ("mod_proxy");
$HTTP["host"] =~ "subdomain\.example\.com" {
  proxy.server = ( "" => (
      ("host" => "127.0.0.1",
      "port" => 801)
    )
  )
}