#46: Fixed CORS bug for production
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user