mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	add cors support for static resources
This commit is contained in:
		| @@ -38,6 +38,7 @@ import ( | |||||||
| 	"github.com/go-macaron/binding" | 	"github.com/go-macaron/binding" | ||||||
| 	"github.com/go-macaron/cache" | 	"github.com/go-macaron/cache" | ||||||
| 	"github.com/go-macaron/captcha" | 	"github.com/go-macaron/captcha" | ||||||
|  | 	"github.com/go-macaron/cors" | ||||||
| 	"github.com/go-macaron/csrf" | 	"github.com/go-macaron/csrf" | ||||||
| 	"github.com/go-macaron/i18n" | 	"github.com/go-macaron/i18n" | ||||||
| 	"github.com/go-macaron/session" | 	"github.com/go-macaron/session" | ||||||
| @@ -131,6 +132,9 @@ func NewMacaron() *macaron.Macaron { | |||||||
| 	if setting.Protocol == setting.FCGI { | 	if setting.Protocol == setting.FCGI { | ||||||
| 		m.SetURLPrefix(setting.AppSubURL) | 		m.SetURLPrefix(setting.AppSubURL) | ||||||
| 	} | 	} | ||||||
|  | 	if setting.EnableCORS { | ||||||
|  | 		m.Use(cors.CORS(setting.CORSConfig)) | ||||||
|  | 	} | ||||||
| 	m.Use(public.Custom( | 	m.Use(public.Custom( | ||||||
| 		&public.Options{ | 		&public.Options{ | ||||||
| 			SkipLogging:  setting.DisableRouterLog, | 			SkipLogging:  setting.DisableRouterLog, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user