Wednesday 15 September 2010

java - How to create a rule that passes only the Request Path - urlrewritefilter -



java - How to create a rule that passes only the Request Path - urlrewritefilter -

since utilize ajax in our pages, need serve search bots requests our ajax prerender service.

to created rule modify crawling requests. <our_domain>/stocks?_escaped_fragment_= converted http://www.my_seo_server.com/my_token_e291b9f/stocks

i used next rule:

<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>

the problem generates wrong url: http://www.my_seo_server.com/my_token_e291b9f/stockshttp://www.my_seo_server.com/my_token_e291b9f.

would love advice on how build rule correctly.

i using urlrewritefilter - 4.0.3

log:

debug|http-apr-8080-exec-2|o.t.w.f.u.u.servernamematcher | looking hostname match on current server name localhost debug|http-apr-8080-exec-2|o.t.w.f.u.urlrewritefilter | checking status path on /stocks debug|http-apr-8080-exec-2|o.t.w.f.urlrewrite.urlrewriter| processing request /stocks debug|http-apr-8080-exec-2|o.t.w.f.urlrewrite.rulebase | escaped_fragment (rule 0) run called /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 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 http://www.my_seo_server.com/my_token_e291b9f debug|http-apr-8080-exec-2|o.t.w.f.u.ruleexecutionoutput | needs proxied 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 lastly info|http-apr-8080-exec-2|o.t.w.f.u.requestproxy | execute, target 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 host configuration info|http-apr-8080-exec-2|o.t.w.f.u.requestproxy | config 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

its seems bug urlrewritefilter. adding "/" , did trick.

this final rule

<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>

java tomcat proxy tuckey-urlrewrite-filter

No comments:

Post a Comment