From eae84f210ea5c362497174d114e94c9e4a2dcca3 Mon Sep 17 00:00:00 2001 From: Joel Chen Date: Thu, 2 Apr 2020 15:33:33 -0700 Subject: [PATCH] fix: return 404 for /favicon.ico in webpack dev server (Hapi) (#1580) --- packages/xarc-app-dev/lib/dev-admin/dev-hapi.js | 3 +++ packages/xarc-app-dev/lib/dev-admin/dev-hapi17.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/packages/xarc-app-dev/lib/dev-admin/dev-hapi.js b/packages/xarc-app-dev/lib/dev-admin/dev-hapi.js index 1f21bc5ec..5cb684467 100644 --- a/packages/xarc-app-dev/lib/dev-admin/dev-hapi.js +++ b/packages/xarc-app-dev/lib/dev-admin/dev-hapi.js @@ -27,6 +27,9 @@ function register(server, options, next) { server.ext({ type: "onRequest", method: (request, reply) => { + if (request.path === "/favicon.ico") { + return reply("").code(404); + } const { req } = request.raw; // simulate a res to capture what the devMiddleware might send back diff --git a/packages/xarc-app-dev/lib/dev-admin/dev-hapi17.js b/packages/xarc-app-dev/lib/dev-admin/dev-hapi17.js index d61305dc7..3c29ef19a 100644 --- a/packages/xarc-app-dev/lib/dev-admin/dev-hapi17.js +++ b/packages/xarc-app-dev/lib/dev-admin/dev-hapi17.js @@ -25,6 +25,9 @@ function register(server) { server.ext({ type: "onRequest", method: (request, h) => { + if (request.path === "/favicon.ico") { + return h.response("").code(404).takeover(); + } const { req } = request.raw; // simulate a res to capture what the devMiddleware might send back