Change QUERYSTRING with the lighttpd proxy

血红的双手。 提交于 2019-12-11 23:27:01

问题


First of all sorry for my English, hope you can undestand it.

I need to change the URL of the destination server with Lighttpd, I mean, someone is going to write an URL like http://my.proxy.server.com/MYQUERY and I need to change it to something like http://XXX.XXX.XXX.XXX/search?q=MYQUERY.

I tried to add an "querystring" option like the configuration below but it didn't work.

proxy.server     = (

                    "" =>
                 (
                   ( "host" => "XXX.XXX.XXX.XXX",
                     "port" => 80,
                     "querystring" => "/search?q=$HTTP[querystring]"
                   )
                 )
                )

I also tried to force changing the URL with the code below but it didn't work neither.

$HTTP["url"] =~ "^/"{
server.querystring = "/search/q=$HTTP[querystring]"
}

What can I do? Does lighttpd have this feature?

thanks


回答1:


Found it. First of all I need to have the mod_rewrite activated, then before the proxy configuration I just need to rewrite the url, like:

url.rewrite-once = ( "/(.*)" => "/search?q=$1" )

Thank you all.



来源:https://stackoverflow.com/questions/12457727/change-querystring-with-the-lighttpd-proxy

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!