[Solved] Simple regex proxy routing not working as expected
Added by alevinetx almost 5 years ago
I have a very simple configuration that is almost identical to one listed as "working" in another forum post.
Post: https://redmine.lighttpd.net/boards/2/topics/8321
In my paste, I have provided my configuration, execution, and the execution log.
Paste: https://pastebin.com/b0q0b4ND
I have nc running on another session, and was getting successful connections without doing any attempts at changing the URL.
Regex: ^/redir-xyz/(.*)
The expectation is if I access :7890/redir-xyz/abc?123 that lighttpd will forward to :16201/abc?123
The result is that a match is initially found, and then the capture group (abc) fails to match.
The relevant configuration portion:
$HTTP["url"] =~ "^/redir-xyz/(.*)" {
url.rewrite-once = ( "^/redir-xyz/(.*)" => "/$1" )
proxy.server = ( "" =>
( "redir for xyz" =>
(
"host" => default.proxy.server.host,
"port" => "16201",
)
)
)
}
I'm quite confused at this point, and gladly appreciate any guidance.
Thank you!
Replies (2)
RE: [Solved] Simple regex proxy routing not working as expected - Added by gstrauss almost 5 years ago
After the rewrite, the conditions are all matched afresh, and will not match ^/redir-xyz.
Please see proxy.header options to rewrite the proxied URL instead of using mod_rewrite. Docs_ModProxy
RE: [Solved] Simple regex proxy routing not working as expected - Added by alevinetx almost 5 years ago
Thank you, that's what I was looking for.
I did see the proxy.headers, but I interpreted "host and URL paths in proxied HTTP headers" to mean "[header]: ...", and not the include the GET path, too., so I did not dig deeper on using that. A simple reword may help future clueless people like myself. :)
something like:
-> ... of proxied HTTP URL paths and host headers
Thank you again for your quick assistance!