May 21

apache rewrite中PT参数的使用

形如这样的例子:RewriteRule ^/AV$ /index.jsp?ve=3&c=999 [PT,QSA],使用PT作为参数,经测试,rewrite行为并不是一个302。(可以自己用wget -d your url测试)。

apache文档中对这个参数解释如下:

‘passthrough|PT’ (pass through to next handler)
This flag forces the rewriting engine to set the uri field of the internal request_rec structure to the value of the filename field. This flag is just a hack to be able to post-process the output of RewriteRule directives by Alias, ScriptAlias, Redirect, etc. directives from other URI-to-filename translators.

对比测试,如果这样配置:RewriteRule ^/HULUCAT$ http://hulucat.com/ABOUT   [R,L],就是302了。

May 13

proxy: No protocol handler was valid for the URL错误解决办法

用apache做负载均衡时遇到了如题的错误。

1.去搜索一下,大多数人的解决办法都是提醒添加LoadModule proxy_http_module modules/mod_proxy_http.so,但是我遇到的情况不灵,因为已经添加这个了。

2.参考了一下http://googolflex.com/?p=492这篇文章,找到原因:

ProxyPass / balancer://mycluster/,后面一定要加“/”,而不是ProxyPass / balancer://mycluster

相应修改后重启apache,服务正常。