Browse Source

feat: 修改csrf作用域

pull/12/head
zhengkunwang223 2 years ago
parent
commit
6ab24989fb
  1. 1
      backend/middleware/csrf.go

1
backend/middleware/csrf.go

@ -12,6 +12,7 @@ import (
func CSRF() gin.HandlerFunc { func CSRF() gin.HandlerFunc {
csrfMd := csrf.Protect( csrfMd := csrf.Protect(
[]byte(global.CONF.Csrf.Key), []byte(global.CONF.Csrf.Key),
csrf.Path("/api"),
csrf.ErrorHandler(http.HandlerFunc( csrf.ErrorHandler(http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) { func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusForbidden) w.WriteHeader(http.StatusForbidden)

Loading…
Cancel
Save