diff options
author | Anton Tananaev <anton@traccar.org> | 2022-08-06 21:47:07 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-08-06 21:47:07 -0700 |
commit | 18799d894619683cbffbbd140648737abd8b4cc5 (patch) | |
tree | 008d390aa424914fada859e81750e5d536afc41a /src/main/java/org/traccar/web/WebServer.java | |
parent | f1cebbcc72359367fc172eb9836339fb33398eb4 (diff) | |
download | trackermap-server-18799d894619683cbffbbd140648737abd8b4cc5.tar.gz trackermap-server-18799d894619683cbffbbd140648737abd8b4cc5.tar.bz2 trackermap-server-18799d894619683cbffbbd140648737abd8b4cc5.zip |
Handle API 404 errors
Diffstat (limited to 'src/main/java/org/traccar/web/WebServer.java')
-rw-r--r-- | src/main/java/org/traccar/web/WebServer.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/web/WebServer.java b/src/main/java/org/traccar/web/WebServer.java index 704a4b3cd..62ac338eb 100644 --- a/src/main/java/org/traccar/web/WebServer.java +++ b/src/main/java/org/traccar/web/WebServer.java @@ -106,7 +106,8 @@ public class WebServer implements LifecycleObject { protected void handleErrorPage( HttpServletRequest request, Writer writer, int code, String message) throws IOException { Path index = Paths.get(config.getString(Keys.WEB_PATH), "index.html"); - if (code == HttpStatus.NOT_FOUND_404 && Files.exists(index)) { + if (code == HttpStatus.NOT_FOUND_404 + && !request.getPathInfo().startsWith("/api/") && Files.exists(index)) { writer.write(Files.readString(index)); } else { writer.write("<!DOCTYPE><html><head><title>Error</title></head><html><body>" |