Skip to content
Snippets Groups Projects
Unverified Commit a2f640db authored by Angelo Capossele's avatar Angelo Capossele Committed by GitHub
Browse files

CORS: AllowOrigins from anywhere (#640)

* :see_no_evil: CORS: AllowOrigins from anywhere

* :wrench: Add default config to CORS configuration
parent f1820da4
No related branches found
No related tags found
No related merge requests found
......@@ -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
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment