fix: need to create custom cors middleware instance for tus
This commit is contained in:
parent
6894cd7e54
commit
5784afe064
17
api/s5/s5.go
17
api/s5/s5.go
|
@ -199,8 +199,23 @@ func BuildS5TusApi(identity ed25519.PrivateKey, accounts *account.AccountService
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
corsMiddleware :=
|
||||||
|
cors.New(cors.Options{
|
||||||
|
AllowedOrigins: []string{"*"},
|
||||||
|
AllowedMethods: []string{"GET", "POST", "PATCH", "DELETE", "HEAD", "OPTIONS"},
|
||||||
|
AllowedHeaders: []string{
|
||||||
|
"Upload-Offset",
|
||||||
|
"X-Requested-With",
|
||||||
|
"Tus-Version",
|
||||||
|
"Tus-Resumable",
|
||||||
|
"Tus-Extension",
|
||||||
|
"Tus-Max-Size",
|
||||||
|
"X-HTTP-Method-Override"},
|
||||||
|
AllowCredentials: true,
|
||||||
|
})
|
||||||
|
|
||||||
// Apply the middlewares to the tusJapeHandler
|
// Apply the middlewares to the tusJapeHandler
|
||||||
tusHandler := middleware.ApplyMiddlewares(tusJapeHandler, cors.Default().Handler, middleware.AuthMiddleware(identity, accounts), injectJwt, protocolMiddleware, stripPrefix, middleware.ProxyMiddleware)
|
tusHandler := middleware.ApplyMiddlewares(tusJapeHandler, corsMiddleware.Handler, middleware.AuthMiddleware(identity, accounts), injectJwt, protocolMiddleware, stripPrefix, middleware.ProxyMiddleware)
|
||||||
|
|
||||||
return tusHandler
|
return tusHandler
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue