package server import ( "net/http" connectcors "connectrpc.com/cors" "github.com/rs/cors" ) // WithCORS adds CORS support to a Connect HTTP handler. func WithCORS(h http.Handler) http.Handler { middleware := cors.New(cors.Options{ // TODO: AllowedOrigins will need to be limited when // the client is embedded to the binary. AllowedOrigins: []string{"*"}, AllowedMethods: connectcors.AllowedMethods(), AllowedHeaders: connectcors.AllowedHeaders(), ExposedHeaders: connectcors.ExposedHeaders(), }) return middleware.Handler(h) }