Skip to content

GOWA - WhatsApp REST API with support for UI, Multi Account, Webhooks, and MCP, and Chatwoot. Built with Golang for efficient memory use.

fix(device.go): Fix DeviceMiddleware to allow if APP_BASE_PATH is change (#519)

Hanif Bagus Guritno503b44fdc205
diff --git a/src/ui/rest/middleware/device.go b/src/ui/rest/middleware/device.go
index e9f48bde..3ae857ef 100644
--- a/src/ui/rest/middleware/device.go
+++ b/src/ui/rest/middleware/device.go
@@ -4,6 +4,7 @@ import (
"net/url"
"strings"
+ "github.com/aldinokemal/go-whatsapp-web-multidevice/config"
"github.com/aldinokemal/go-whatsapp-web-multidevice/infrastructure/whatsapp"
"github.com/aldinokemal/go-whatsapp-web-multidevice/pkg/utils"
"github.com/gofiber/fiber/v2"
@@ -16,7 +17,8 @@ const DeviceIDHeader = "X-Device-Id"
func DeviceMiddleware(dm *whatsapp.DeviceManager) fiber.Handler {
return func(c *fiber.Ctx) error {
// Allow non-device-scoped public endpoints (e.g., landing page) to pass through.
- if path := strings.TrimSpace(c.Path()); path == "/" || path == "" {
+ path := strings.TrimSpace(c.Path())
+ if path == "/" || path == "" || path == config.AppBasePath || path == config.AppBasePath+"/" {
return c.Next()
}