Project

General

Profile

[UE] lighttpd as reverseproxy in front of docker containers

Added by chaplin 4 months ago

Hi I am trying to configure lighttpd as a reverse proxy in front of a couple of containers in a local network. I am partially successful but only partially. I would very much appreciate your help.

What I want to do for instance is have "rouncube mail" to work on http://localhost/mail it is currently running on http://localhost:8000 in a docker container. What I did is configure

$HTTP["url"] =~ "^/mail" {
    proxy.server = ( "" => ("" => ( "host" => "127.0.0.1", "port" => 8000 ))),
    proxy.header = (
        "map-urlpath" => (
                "/mail" => "/",
                "/mail/(.*)$" => "/$1" 
                ),
        ),
 }

It works at first but after login the path "/mail" is gone to I guess I also need to replace all URLs in the responses corresponding to requests that go to port 8000. Unfortunately I was not successfull doing this :(


Replies (1)

RE: lighttpd as reverseproxy in front of docker containers - Added by gstrauss 4 months ago

lighttpd does not parse and rewrite arbitrary response body content (which might not be HTML) to remap URLs in the response body content.

Your backend app, e.g. "rouncube mail" (sic) (maybe you meant RoundCube?) must be configured to generate HTML links with /mail, or that app should use relative paths rather than paths starting with '/'. You should refer to RoundCube documentation for how to do this. You probably want to configure roundcube to be under /mail on your backend proxy running on port 8000, and then to proxy from lighttpd without "map-urlpath".

    (1-1/1)