From 6fd61fe13aab560b8c6096f23485ee2721030e02 Mon Sep 17 00:00:00 2001 From: natalie-bernhard Date: Wed, 15 May 2024 09:04:28 -0500 Subject: [PATCH] send 404 error when getting 404 page --- src/main/java/io/openliberty/website/SecurityFilter.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/openliberty/website/SecurityFilter.java b/src/main/java/io/openliberty/website/SecurityFilter.java index 936377809f..0a03ca5950 100644 --- a/src/main/java/io/openliberty/website/SecurityFilter.java +++ b/src/main/java/io/openliberty/website/SecurityFilter.java @@ -109,8 +109,10 @@ public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain req.getRequestDispatcher(uri.concat(".gz")).include(req, response); } catch(FileNotFoundException e) { - response.setStatus(HttpServletResponse.SC_NOT_FOUND); - response.sendRedirect("/404.html"); + response.reset(); + response.setHeader("Content-Type", "text/html"); + response.sendError(404); + return; } } } else if (uri.startsWith("/api/builds/") || uri.startsWith("/api/github/")) {