I have a website www.somewebsite.com
domain hosted on lighttpd 1.4 server configured with server.port = 8080
that is on a device (A) with local IP 192.168.1.26
and I want to get to use a reverse proxy in order to access another server that runs on a different device (B) at 192.168.1.30:80/myapp
in order to be accessed as
somewebsite.com/myapp
In device (A) server config I have enabled mod_proxy
and I have tried to add
$HTTP["url"] =~ "^.*myapp" {
proxy.server = ( "" =>
(( "(www.)?somewebsite.com" => "192.168.1.30", "port" => 80 ))
)
}
but I get internal server error page when I try to access somewebsite.com/myapp
I have tried also
$HTTP["url"] =~ "(^/myapp/)" {
proxy.server = ( "" => ("" => ( "(www.)?somewebsite.com" => "127.0.0.1", "port" => 8080 )))
}
$SERVER["socket"] == ":81" {
url.rewrite-once = ( "^/myapp/(.*)$" => "/$1" )
proxy.server = ( "" => ( "" => ( "(www.)?somewebsite.com" => "192.168.1.30", "port" => 80 )))
}
but the result is even worse and server crashes completely
proxy.server
do not take host as an argument, and "host" is a keyword, not a place to put your host here.Try this:
Alternatively, you can use
proxy.header
with"map-urlpath"
with lighttpd 1.4.46 and later. See https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModProxy