Esempio n. 1
0
func (s *Server) corsHandler(h http.Handler) http.Handler {
	dirs := s.conf.GetDirectives()
	opts := cors.Options{}
	opts.AllowedOrigins = dirs.Server.CORSAccessControlAllowOrigin
	opts.AllowedMethods = dirs.Server.CORSAccessControlAllowMethods
	opts.AllowedHeaders = dirs.Server.CORSAccessControlAllowHeaders
	return cors.New(opts).Handler(h)
}