Java 如何创建只通过请求路径的规则-URLRewiteFilter
由于我们在页面中使用ajax,因此我们需要从ajax预呈现服务为搜索机器人提供请求 为此,我创建了一个规则来修改爬网请求。Java 如何创建只通过请求路径的规则-URLRewiteFilter,java,tomcat,proxy,tuckey-urlrewrite-filter,Java,Tomcat,Proxy,Tuckey Urlrewrite Filter,由于我们在页面中使用ajax,因此我们需要从ajax预呈现服务为搜索机器人提供请求 为此,我创建了一个规则来修改爬网请求。 /stocks?\u转义的\u片段转换为http://www.MY_SEO_SERVER.com/MY_TOKEN_e291b9f/stocks 我使用了以下规则: <rule> <name>escaped_fragment</name> <!--<condition type="request
/stocks?\u转义的\u片段
转换为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>
这看起来像是一个URLEwriteFilter的bug。将“/”添加到并完成了此操作 这是最后的规则
<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>
逃逸碎片
*转义的\u片段*
^/(.*)$
http://www.MY_SEO_SERVER.com/TOKEN_e291b9f78/$1
<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>