Project

General

Profile

proxy a directory to another server

Added by bWGi about 13 years ago

First of all I would like to say sorry if this question has already been asked I have been searching the forums and the internet for a few weeks to find it, Also, I believe this is the right forum if not I am very sorry.

Anyways, my server is behind another server running lighthttpd and I would like to be able to set it up so that any requests to a folder get sent to my server minus the folder name, without changing the url since the actual server is unreachable outside of the local network.
eg:

http://www.example.com/dir/(.*)
to
192.168.2.9/(.*)

Is this possible, if so how?


Replies (4)

RE: proxy a directory to another server - Added by cheungtifan about 13 years ago

$HTTP["url"] =~ "^/dir/" {
proxy.server = (xxx)
}

RE: proxy a directory to another server - Added by bWGi about 13 years ago

so to check, would:

$HTTP["url"] =~ "^/dir/" {
    proxy.server = (
        "" => ( (
            "host" => "192.168.2.9",
            "port" => 80
        ) )
    )
}

redirect all requests targeted at the dir directory /dir/ to 192.168.2.9?
EG:
http://www.example.com/dir/index.html => 192.168.2.9/index.html
?

RE: proxy a directory to another server - Added by canilao almost 10 years ago

I am having this issue now. I want a directory to be pointed to another server, but at its root. So if the browser goes to www.example.com/maps, it wants to go to 127.0.0.1:1975/maps. I would like it to point to 127.0.0.1

You ever get this working right?

My config is just like above.

RE: proxy a directory to another server - Added by stbuehler almost 10 years ago

Our standard reply is: don't. It will most certainly screw up any URLs the backend generates. It's also hard to do with lighttpd.

If the web application at the backend has to be at the "root" directory pick a separate vhost name at the frontend and put it at the root there too. Otherwise have the application in the same subdirectory on the backend as on the frontend.

    (1-4/4)