0

I got 2 server under same network and I hope to redirect domain.com/page to 192.168.2.16:22348 so i got this in lighttpd.conf according to this: lighttpd as reverse-proxy

$HTTP["url"] =~ "^/page" {
  proxy.server = ( "" => ( ( "host" =>  "192.168.2.16", "port" => 22348 ) ) )
}

but I ended up getting redirected to 192.168.2.16/maps which doesn't exist (I only got index.html but I can't change it) and returned 404. Is there any way to only pass IP and port but not /page?

(I also tried domain.com/google to google.com by the same way but ended up to google.com/google)

Others I also tried: https://redmine.lighttpd.net/projects/1/wiki/Docs_ModProxy

Adrian0811
  • 13
  • 2
  • Your have not explained your question very well. You should edit it with a more explicit example of what request you are sending and what pseudo-request you want to send, or what response your are getting and what response you want to get. Please be more explicit. – gstrauss Sep 20 '21 at 04:21

2 Answers2

0

Others I also tried: https://redmine.lighttpd.net/projects/1/wiki/Docs_ModProxy

I think you should look at proxy.header "map-urlpath" on the same page.

gstrauss
  • 2,091
  • 1
  • 12
  • 16
0

So instead of using www.domain.com/page, i decided to use subdomain.domain.com. Here's what I got.

$HTTP["host"] =~ "subdomain.domain.com" {
  proxy.server = ( "" =>  ( ( "host" => "192.168.2.16", "port" => "22348" ) ) )
}

Since there is nothing after subdomain.domain.com/, it won't pass anything but only ip and port (192.168.2.16:22348) so I don't need to modify anything from the second machine. I think this is easier to configure instead of using /page.

Adrian0811
  • 13
  • 2