diff --git a/internal/server/apiPath/apiPath.go b/internal/server/apiPath/apiPath.go
index c2efc1e959d1a9d53a448f0dbb5c8971454e2482..abd6ad8af5e86d4caa78e2d3b65103420eac9b7a 100644
--- a/internal/server/apiPath/apiPath.go
+++ b/internal/server/apiPath/apiPath.go
@@ -1,4 +1,7 @@
 package apiPath
 
+// Prefix is the api prefix path component
+const Prefix = "/api"
+
 // V0 gives the api path for v0
-const V0 = "/api/v0"
+const V0 = Prefix + "/v0"
diff --git a/internal/server/server.go b/internal/server/server.go
index fddb392bd72c6eeac09b974371b95bae56b2a515..92d97da9286fa5cdb01174794650f6436e07b6f3 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -20,6 +20,7 @@ import (
 	"github.com/oidc-mytoken/server/internal/endpoints/consent"
 	"github.com/oidc-mytoken/server/internal/endpoints/redirect"
 	"github.com/oidc-mytoken/server/internal/model"
+	"github.com/oidc-mytoken/server/internal/server/apiPath"
 	"github.com/oidc-mytoken/server/internal/server/routes"
 	"github.com/oidc-mytoken/server/internal/server/ssh"
 )
@@ -70,7 +71,10 @@ func Init() {
 	addRoutes(server)
 	server.Use(
 		func(ctx *fiber.Ctx) error {
-			if ctx.Accepts(fiber.MIMETextHTML, fiber.MIMETextHTMLCharsetUTF8) != "" {
+			path := ctx.Path()
+			if !strings.HasPrefix(path, apiPath.Prefix) && ctx.Accepts(
+				fiber.MIMETextHTML, fiber.MIMETextHTMLCharsetUTF8,
+			) != "" {
 				ctx.Status(fiber.StatusNotFound)
 				return ctx.Render(
 					"sites/404", map[string]interface{}{
@@ -81,7 +85,8 @@ func Init() {
 			return model.Response{
 				Status: fiber.StatusNotFound,
 				Response: api.Error{
-					Error: "not_found",
+					Error:            "not_found",
+					ErrorDescription: path,
 				},
 			}.Send(ctx)
 		},