【发布时间】:2014-11-05 05:22:46
【问题描述】:
由于我们在页面中使用 ajax,我们需要为来自 Ajax Prerender 服务的搜索机器人请求提供服务。
为此,我创建了一个规则来修改抓取请求。
<OUR_DOMAIN>/stocks?_escaped_fragment_= 转换为 http://www.MY_SEO_SERVER.com/MY_TOKEN_e291b9f/stocks
我使用了以下规则:
<rule>
<name>escaped_fragment</name>
<!--<condition type="request-filename" operator="notfile"/>-->
<condition type="query-string" operator="equal">.*escaped_fragment.*</condition>
<from>(.*)$</from>
<to type="proxy" last="true" qsappend="true">http://www.MY_SEO_SERVER.com/TOKEN_e291b9f78$1</to>
</rule>
问题是它生成了错误的 URL:http://www.MY_SEO_SERVER.com/MY_TOKEN_e291b9f/stockshttp://www.MY_SEO_SERVER.com/MY_TOKEN_e291b9f。
希望获得有关如何正确构建规则的建议。
我正在使用 urlrewritefilter - 4.0.3
日志:
DEBUG|http-apr-8080-exec-2|o.t.w.f.u.u.ServerNameMatcher | looking for hostname match on current server name localhost
DEBUG|http-apr-8080-exec-2|o.t.w.f.u.UrlRewriteFilter | checking for status path on /stocks
DEBUG|http-apr-8080-exec-2|o.t.w.f.urlrewrite.UrlRewriter| processing request for /stocks
DEBUG|http-apr-8080-exec-2|o.t.w.f.urlrewrite.RuleBase | escaped_fragment (rule 0) run called with /stocks
DEBUG|http-apr-8080-exec-2|o.t.w.f.urlrewrite.RuleBase | matched "from"
DEBUG|http-apr-8080-exec-2|o.t.w.f.urlrewrite.Condition | evaluating "_escaped_fragment_=" against .*escaped_fragment.*
DEBUG|http-apr-8080-exec-2|o.t.w.f.urlrewrite.RuleBase | conditions match
DEBUG|http-apr-8080-exec-2|o.t.w.f.u.s.MatcherReplacer | found 1
DEBUG|http-apr-8080-exec-2|o.t.w.f.u.s.MatcherReplacer | replaced sb is http://www.MY_SEO_SERVER.com/MY_TOKEN_e291b9f/stocks
DEBUG|http-apr-8080-exec-2|o.t.w.f.u.s.MatcherReplacer | found 1
DEBUG|http-apr-8080-exec-2|o.t.w.f.u.s.MatcherReplacer | replaced sb is http://www.MY_SEO_SERVER.com/MY_TOKEN_e291b9f
DEBUG|http-apr-8080-exec-2|o.t.w.f.u.RuleExecutionOutput | needs to be
proxied from http://www.MY_SEO_SERVER.com/MY_TOKEN_e291b9f/stockshttp://www.MY_SEO_SERVER.com/MY_TOKEN_e291b9f
DEBUG|http-apr-8080-exec-2|o.t.w.f.urlrewrite.UrlRewriter| rule is last
INFO|http-apr-8080-exec-2|o.t.w.f.u.RequestProxy | execute,
target is http://www.MY_SEO_SERVER.com/MY_TOKEN_e291b9f/stockshttp://www.MY_SEO_SERVER.com/MY_TOKEN_e291b9f
INFO|http-apr-8080-exec-2|o.t.w.f.u.RequestProxy | response commit state: false
INFO|http-apr-8080-exec-2|o.t.w.f.u.RequestProxy | checking url
INFO|http-apr-8080-exec-2|o.t.w.f.u.RequestProxy | seting up the host configuration
INFO|http-apr-8080-exec-2|o.t.w.f.u.RequestProxy | config is HostConfiguration[host=http://www.MY_SEO_SERVER.com]
INFO|http-apr-8080-exec-2|o.t.w.f.u.RequestProxy | setting proxy request parameter:connection, value: keep-alive
【问题讨论】:
标签: java tomcat proxy tuckey-urlrewrite-filter