1

I am trying to configure lighttpd (v1.5) as a reverse proxy. Gollum is running on port 8080 and I've setup lighttpd.conf as per the following:

$HTTP["url"] =~ "^/wiki.*" {
    proxy-core.protocol = "http"
    proxy-core.backends = ("127.0.0.1:8080")
    proxy-core.rewrite-request = ("_uri" => ("^/wiki(.*)" => "/$1"))
    proxy-core.rewrite-response = ("_url" => ("^/(.*)" => "/wiki/$1"))
}

Requests are being forwarded fine, but links are not being rewritten. The situation appears similar to lighttpd 1.5 reverse-proxy to trac in so much as browsing to

http://192.168.1.1/wiki/

loads the page, but without any of it's resources (CSS, etc.) and following a link does not include the /wiki infix, e.g.:

http://192.168.1.1/pages

How do the rewrite rules work in this situation?

3
  • Can you clarify what you're intending the rewrite rules to do (original URL, rewritten URL examples)? Seems like the ? in the request rule is intended to be a /. Oct 13, 2011 at 22:46
  • Sorry, the ? was a typo. To confirm, I'd like to be able to browse to http://192.168.1.1/wiki which is a proxy to a service running on http://192.168.1.1:8080. Original URLs on that service are like: http://192.168.1.1:8080/edit/Home, which I'd like rewritten to http://192.168.1.1/wiki/edit/Home.
    – tlvince
    Oct 14, 2011 at 14:38
  • 1
    Oh, gotcha. The response rewrite unfortunately only translates redirection URLs in the headers - those found in the response code aren't translated. If the wiki's links are sending to absolute locations (with a leading slash), then unfortunately, you can't have lighttpd take care of it for you - you'll need to wrangle the application into sending the correct references in its content. Oct 14, 2011 at 17:25

0

You must log in to answer this question.

Browse other questions tagged .