Skip to content

Commit 42f964f

Browse files
committed
add cors support for static resources
1 parent c559a9f commit 42f964f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

routers/routes/routes.go

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import (
3838
"github.com/go-macaron/binding"
3939
"github.com/go-macaron/cache"
4040
"github.com/go-macaron/captcha"
41+
"github.com/go-macaron/cors"
4142
"github.com/go-macaron/csrf"
4243
"github.com/go-macaron/i18n"
4344
"github.com/go-macaron/session"
@@ -131,6 +132,9 @@ func NewMacaron() *macaron.Macaron {
131132
if setting.Protocol == setting.FCGI {
132133
m.SetURLPrefix(setting.AppSubURL)
133134
}
135+
if setting.EnableCORS {
136+
m.Use(cors.CORS(setting.CORSConfig))
137+
}
134138
m.Use(public.Custom(
135139
&public.Options{
136140
SkipLogging: setting.DisableRouterLog,

0 commit comments

Comments
 (0)