#46: Fixed CORS bug for production

This commit is contained in:
frikky
2020-06-04 03:25:32 +02:00
parent 00ff09a97f
commit 5c81238386
+1 -2
View File
@@ -2159,8 +2159,8 @@ func setUser(ctx context.Context, data *User) error {
}
func handleCors(resp http.ResponseWriter, request *http.Request) bool {
// FIXME - this is to handle multiple frontends in test rofl
if request.Method == "OPTIONS" {
origin := request.Header["Origin"]
resp.Header().Set("Vary", "Origin")
if len(origin) > 0 {
@@ -2173,7 +2173,6 @@ func handleCors(resp http.ResponseWriter, request *http.Request) bool {
resp.Header().Set("Access-Control-Allow-Methods", "POST, GET, PUT, DELETE")
resp.Header().Set("Access-Control-Allow-Credentials", "true")
if request.Method == "OPTIONS" {
resp.WriteHeader(200)
resp.Write([]byte("OK"))
return true