Lighttpd拆分请求URI并删除查询参数

我正在运行lighttpd 1.4.33,它是从互联网开放的Apache服务器反向代理的。 当从lighttpd服务器的本地地址访问脚本时,GETparameter passing给脚本就好了,我得到了预期的结果。 但是,当通过代理访问脚本(并由以下lighttpd规则重写)时,查询参数似乎完全被删除。

似乎是导致问题的重写规则:

$HTTP["host"] =~ "^site\.example\.com$" { # This affects the requests that aren't rewritten below, ie. static stuff server.document-root = "/var/www/example/public" url.rewrite-once = ( "^((?!assets).)*$" => "index.php/$1" ) } 

这应该是重写所有URL,以便它们通过index.php中的路由引擎传递,除了/assets目录中的静态内容(静态内容)。 请注意, /assets/var/www/example/public的子目录,所以这个工作正常。

Lighttpd用下拉参数debugging请求的日志:

 2014-07-23 11:36:46: (response.c.310) Request-URI : /foo/bar?someparam=data 2014-07-23 11:36:46: (response.c.311) URI-scheme : http 2014-07-23 11:36:46: (response.c.312) URI-authority: site.example.com 2014-07-23 11:36:46: (response.c.313) URI-path : /foo/bar 2014-07-23 11:36:46: (response.c.314) URI-query : someparam=data 2014-07-23 11:36:46: (response.c.309) -- splitting Request-URI 2014-07-23 11:36:46: (response.c.310) Request-URI : index.php/a 2014-07-23 11:36:46: (response.c.311) URI-scheme : http 2014-07-23 11:36:46: (response.c.312) URI-authority: site.example.com 2014-07-23 11:36:46: (response.c.313) URI-path : index.php/a 2014-07-23 11:36:46: (response.c.314) URI-query : 

请注意最后一行中的空白URI-query字段。 看起来好像“拆分请求URI”这个步骤正在破坏一切。

任何想法可能会导致这一点?

事实certificate,在lighttpd> = 1.4.24上有一个更简单的方法。 你可以使用url.rewrite-if-not-file指令,像这样(lighttpd <= 1.4.33 ):

 $HTTP["host"] =~ "^site\.example\.com$" { # Rewrite all requests to non-physical files url.rewrite-if-not-file = ( "^(.*)$" => "index.php/$1" ) } 

该示例使用$HTTP["host"]指令,因为直到1.4.34才使用$HTTP["url"] 指令 。 在lighttpd> = 1.4.34 ,可以在URL条件块中使用它:

 $HTTP["url"] =~ "^\/site/$" { # Rewrite all requests to non-physical files url.rewrite-if-not-file = ( "^(.*)$" => "index.php/$1" ) } 

我想如果你真的被迫使用lighttpd <= 1.4.24 , 你总是可以使用mod_magnet和Lua。