Skip to content

Commit

Permalink
add cors support for static resources
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Jul 14, 2019
1 parent c559a9f commit 42f964f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions routers/routes/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"github.com/go-macaron/binding"
"github.com/go-macaron/cache"
"github.com/go-macaron/captcha"
"github.com/go-macaron/cors"
"github.com/go-macaron/csrf"
"github.com/go-macaron/i18n"
"github.com/go-macaron/session"
Expand Down Expand Up @@ -131,6 +132,9 @@ func NewMacaron() *macaron.Macaron {
if setting.Protocol == setting.FCGI {
m.SetURLPrefix(setting.AppSubURL)
}
if setting.EnableCORS {
m.Use(cors.CORS(setting.CORSConfig))
}
m.Use(public.Custom(
&public.Options{
SkipLogging: setting.DisableRouterLog,
Expand Down

0 comments on commit 42f964f

Please sign in to comment.