Skip to content

Commit d317d93

Browse files
committed
fix: 静态资源解决root cannot start with '/'
1 parent 18c2b02 commit d317d93

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/top/meethigher/proxy/http/ReverseHttpProxy.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import io.vertx.ext.web.Route;
1010
import io.vertx.ext.web.Router;
1111
import io.vertx.ext.web.RoutingContext;
12+
import io.vertx.ext.web.handler.FileSystemAccess;
1213
import io.vertx.ext.web.handler.StaticHandler;
1314
import org.slf4j.Logger;
1415
import org.slf4j.LoggerFactory;
@@ -365,7 +366,8 @@ public ReverseHttpProxy addRoute(
365366
String targetUrl = proxyRoute.getTargetUrl();
366367
if (targetUrl.startsWith(STATIC)) {
367368
String staticPath = targetUrl.replace(STATIC, "");
368-
StaticHandler staticHandler = StaticHandler.create(staticPath)
369+
// https://github.com/vert-x3/vertx-web/issues/204
370+
StaticHandler staticHandler = StaticHandler.create(FileSystemAccess.ROOT, staticPath)
369371
.setDirectoryListing(false)
370372
.setAlwaysAsyncFS(true)
371373
.setIndexPage("index.html");

0 commit comments

Comments
 (0)