aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-08-06 21:47:07 -0700
committerAnton Tananaev <anton@traccar.org>2022-08-06 21:47:07 -0700
commit18799d894619683cbffbbd140648737abd8b4cc5 (patch)
tree008d390aa424914fada859e81750e5d536afc41a /src
parentf1cebbcc72359367fc172eb9836339fb33398eb4 (diff)
downloadtrackermap-server-18799d894619683cbffbbd140648737abd8b4cc5.tar.gz
trackermap-server-18799d894619683cbffbbd140648737abd8b4cc5.tar.bz2
trackermap-server-18799d894619683cbffbbd140648737abd8b4cc5.zip
Handle API 404 errors
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/web/WebServer.java3
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>"