diff --git a/main.go b/main.go
index 5b8431701da45d7feeeb23c6b4f62797f4b14f85..d0d1dd053cec5c655b5846eaa93e1a77b77a38c4 100644
--- a/main.go
+++ b/main.go
@@ -83,10 +83,11 @@ func triggerPuppet(w http.ResponseWriter, req *http.Request) {
 	authToken := strings.Split(req.Header.Get("Authorization"), "Bearer ")[1]
 	statusFile := "/tmp/200.json"
 	writeFile(fmt.Sprintf("{\n    \"status\": \"OK\",\n    \"response\": 200\n    \"token\": %v\n}", authToken), "/tmp/200.json")
-	writeFile(fmt.Sprintf("{\n    \"status\": \"KO\",\n    \"response\": 503\n    \"token\": %v\n}", authToken), "/tmp/503.json")
+	writeFile(fmt.Sprintf("{\n    \"status\": \"KO\",\n    \"response\": 401\n    \"token\": %v\n}", authToken), "/tmp/503.json")
 	if authToken != bearerToken {
-		statusFile = "/tmp/503.json"
-		//w.WriteHeader(http.StatusUnauthorized)
+		statusFile = "/tmp/401.json"
+		w.WriteHeader(http.StatusUnauthorized)
+		http.ServeFile(w, req, statusFile)
 	} else {
 		cmd.Run()
 		if verboseBool {