File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
src/test/java/top/meethigher/proxy/http Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -52,11 +52,20 @@ public void testStatic() throws Exception {
52
52
proxy .start ();
53
53
ProxyRoute proxyRoute = new ProxyRoute ();
54
54
proxyRoute .setHttpKeepAlive (false );
55
- // proxyRoute.setSourceUrl("/*");
56
- // proxyRoute.setTargetUrl("static:D:/Desktop");
57
- proxyRoute .setSourceUrl ("/blog/*" );
58
- proxyRoute .setTargetUrl ("static:D:/3Develop/www/hexoBlog/blog/public" );
59
- proxy .addRoute (proxyRoute );
55
+ proxyRoute .setSourceUrl ("/*" );
56
+ proxyRoute .setTargetUrl ("https://reqres.in" );
57
+ proxy .addRoute (proxyRoute , Integer .MAX_VALUE );
58
+
59
+ ProxyRoute proxyRoute1 = new ProxyRoute ();
60
+ proxyRoute1 .setSourceUrl ("/test/*" );
61
+ proxyRoute1 .setTargetUrl ("https://meethigher.top" );
62
+ proxy .addRoute (proxyRoute1 , Integer .MAX_VALUE - 1 );
63
+
64
+ // 若静态路径下的内容不存在,则会匹配到/*。此时就会出现个假象,order未生效。
65
+ ProxyRoute proxyRoute2 = new ProxyRoute ();
66
+ proxyRoute2 .setSourceUrl ("/static/*" );
67
+ proxyRoute2 .setTargetUrl ("static:D:/3Develop/www" );
68
+ proxy .addRoute (proxyRoute2 , Integer .MAX_VALUE - 2 );
60
69
TimeUnit .HOURS .sleep (1 );
61
70
proxy .stop ();
62
71
}
You can’t perform that action at this time.
0 commit comments