mirror of https://github.com/status-im/go-waku.git
feat: enable CORS for REST API (#1067)
This commit is contained in:
parent
b199b08ed6
commit
53e0ea6ac6
|
@ -38,7 +38,12 @@ func NewWakuRest(node *node.WakuNode, config RestConfig, log *zap.Logger) *WakuR
|
||||||
mux := chi.NewRouter()
|
mux := chi.NewRouter()
|
||||||
mux.Use(middleware.Logger)
|
mux.Use(middleware.Logger)
|
||||||
mux.Use(middleware.NoCache)
|
mux.Use(middleware.NoCache)
|
||||||
|
mux.Use(func(h http.Handler) http.Handler {
|
||||||
|
fn := func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||||
|
}
|
||||||
|
return http.HandlerFunc(fn)
|
||||||
|
})
|
||||||
if config.EnablePProf {
|
if config.EnablePProf {
|
||||||
mux.Mount("/debug", middleware.Profiler())
|
mux.Mount("/debug", middleware.Profiler())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue