feat: allow cross-origin requests between users' own apps (#7688)

This commit is contained in:
Asher
2023-06-07 11:08:14 -08:00
committed by GitHub
parent 125e9ef00e
commit f0c5201617
5 changed files with 195 additions and 32 deletions
+3 -3
View File
@@ -408,7 +408,6 @@ func New(options *Options) *API {
prometheusMW := httpmw.Prometheus(options.PrometheusRegistry)
r.Use(
cors,
httpmw.Recover(api.Logger),
tracing.StatusWriterMiddleware,
tracing.Middleware(api.TracerProvider),
@@ -419,9 +418,10 @@ func New(options *Options) *API {
// SubdomainAppMW checks if the first subdomain is a valid app URL. If
// it is, it will serve that application.
//
// Workspace apps do their own auth and must be BEFORE the auth
// middleware.
// Workspace apps do their own auth and CORS and must be BEFORE the auth
// and CORS middleware.
api.workspaceAppServer.HandleSubdomain(apiRateLimiter),
cors,
// Build-Version is helpful for debugging.
func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {