diff --git a/plugins/webapi/plugin.go b/plugins/webapi/plugin.go index 24074bf6193a7e8272fe7fc93be44cf36c298a36..d96f0fe1c68ab6f3c1ec655b652e4c652779a7f8 100644 --- a/plugins/webapi/plugin.go +++ b/plugins/webapi/plugin.go @@ -13,6 +13,7 @@ import ( "github.com/iotaledger/hive.go/logger" "github.com/iotaledger/hive.go/node" "github.com/labstack/echo" + "github.com/labstack/echo/middleware" ) // PluginName is the name of the web API plugin. @@ -41,6 +42,11 @@ func Plugin() *node.Plugin { func Server() *echo.Echo { serverOnce.Do(func() { server = echo.New() + server.Use(middleware.CORSWithConfig(middleware.CORSConfig{ + Skipper: middleware.DefaultSkipper, + AllowOrigins: []string{"*"}, + AllowMethods: []string{http.MethodGet, http.MethodHead, http.MethodPut, http.MethodPatch, http.MethodPost, http.MethodDelete}, + })) }) return server }