I have 2 separate applications. One is based on libwebsockts which works on port 8081 and the other based on libmicrohttpd which runs on port 8080. Both of these services run on localhost.
What I am trying to do is to use lighttpd with mod_proxy to proxy incoming requests to appropriate service. Which I failed to do.
---> wss://localhost/websocket --- -wss-> 8081 port
/ \ /
react lighttpd
\ / \
---> http://localhost/app ------- -http-> 8080 port
It either work one way or the other.
My best guess of lighttpd.conf is
$HTTP["url"] =~ "^/app/" {
proxy.server = (
"" => ((
"host" => "127.0.0.1",
"port" => 8080
)),
)
}
$HTTP["url"] =~ "^/websocket/" {
proxy.server = (
"" => ((
"host" => "127.0.0.1",
"port" => 8081
)),
)
}
$REQUEST_HEADER["Upgrade"] == "websocket" {
setenv.set-request-header = ("Connection" => "Upgrade")
proxy.header = ( "upgrade" => "enable" )
proxy.server = ( "" => ( ( "host" => "localhost", "port" => "8081" ) ) )
}
What am I doing wrong?