From 97ab818442d29024816bc72a36261e23750275bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=83=B3=E5=BD=93=E5=BD=93?= Date: Fri, 5 Sep 2014 18:12:50 +0800 Subject: [PATCH] 404 --- lib/requestHandler.js | 7 ++++++- web/404.html | 27 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 web/404.html diff --git a/lib/requestHandler.js b/lib/requestHandler.js index d4b5e90..a480302 100644 --- a/lib/requestHandler.js +++ b/lib/requestHandler.js @@ -171,7 +171,12 @@ function userRequestHandler(req,userRes){ //send response },function(callback){ - userRes.end(serverResData); + if(404 == statusCode){ + var html404path = pathUtil.join(__dirname, '..', 'web', '404.html'); + userRes.end(fs.readFileSync(html404path)); + }else{ + userRes.end(serverResData); + } callback(); //udpate record info diff --git a/web/404.html b/web/404.html new file mode 100644 index 0000000..1a7adc2 --- /dev/null +++ b/web/404.html @@ -0,0 +1,27 @@ + + + + Anyproxy - 404 NOT FOUND + + + + +

404 NOT FOUND

+ + \ No newline at end of file