diff --git a/router.go b/router.go index 442a4dbb..94f4279f 100644 --- a/router.go +++ b/router.go @@ -459,6 +459,12 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) context.Output = beecontext.NewOutput(rw) } + // session init + if SessionOn { + context.Input.CruSession = GlobalSessions.SessionStart(w, r) + defer context.Input.CruSession.SessionRelease() + } + if !utils.InSlice(strings.ToLower(r.Method), HTTPMETHOD) { http.Error(w, "Method Not Allowed", 405) goto Admin @@ -529,12 +535,6 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) } } - // session init after static file - if SessionOn { - context.Input.CruSession = GlobalSessions.SessionStart(w, r) - defer context.Input.CruSession.SessionRelease() - } - if do_filter(AfterStatic) { goto Admin }