diff --git a/routers/web/web.go b/routers/web/web.go index a47ce2bff7..43ce0dba6d 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -192,7 +192,8 @@ func verifyAuthWithOptions(options *common.VerifyOptions) func(ctx *context.Cont return } - if !options.SignOutRequired && !options.DisableCSRF && ctx.Req.Method == "POST" { + safeMethod := ctx.Req.Method == "GET" || ctx.Req.Method == "HEAD" || ctx.Req.Method == "OPTIONS" + if !options.SignOutRequired && !options.DisableCSRF && !safeMethod { ctx.Csrf.Validate(ctx) if ctx.Written() { return