Browse Source

Allow GET requests without CSRF

Jakob Borg 11 years ago
parent
commit
d65bbf2113
1 changed files with 6 additions and 0 deletions
  1. 6 0
      cmd/syncthing/gui_csrf.go

+ 6 - 0
cmd/syncthing/gui_csrf.go

@@ -43,6 +43,12 @@ func csrfMiddleware(prefix string, next http.Handler) http.Handler {
 			return
 		}
 
+		if r.Method == "GET" {
+			// Allow GET requests unconditionally
+			next.ServeHTTP(w, r)
+			return
+		}
+
 		// Verify the CSRF token
 		token := r.Header.Get("X-CSRF-Token")
 		if !validCsrfToken(token) {