第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

go gorilla/sessions angularjs 和路徑,未保存會話值(找到錯誤/歸咎于)

go gorilla/sessions angularjs 和路徑,未保存會話值(找到錯誤/歸咎于)

Go
慕碼人8056858 2021-07-09 14:19:53
好的,從哪里開始...問題是,當我設置會話是Path到"/"會話不會得到保存。我設置Path是因為當發(fā)布到不是保存會話的路徑的路徑時,也session.Save()稱為會話值“用戶”為空|nil|未設置。所以我設置了Path: "/",但會話沒有保存。檢查 Chromium 時,我看到 cookie 已設置。我不知道問題出在哪里。是在大猩猩/會議中嗎?是在 AngularJS 中嗎?HTML5 模式在 angular 中處于關閉狀態(tài)。所以改寫一下,發(fā)生這種情況是因為與調用函數(shù)的/api/1.0/community路徑不同,這就是我設置. 但是,當是會話值“用戶”不會被保存。/api/1.0/usersessions.Save(r,w)Path: "/",Path"/"main.govar (    sessionStore    *sessions.CookieStore    sessionAuthKey  []byte      = make([]byte, 64)    sessionCryptKey []byte      = make([]byte, 32)    router          *mux.Router = mux.NewRouter())func init() {    // Generate Session Secret    sessionAuthKey = securecookie.GenerateRandomKey(64)    sessionCryptKey = securecookie.GenerateRandomKey(32)    // Create Session    sessionStore = sessions.NewCookieStore(sessionAuthKey, sessionCryptKey)    sessionStore.Options = &sessions.Options{        Domain: ".mango.dev",        Path:   "/",        MaxAge: 0,    }}func main() {    api := router.PathPrefix("/api/1.0").Subrouter()    api.HandleFunc("/user/register", UserRegisterHandler).Methods("POST")    api.HandleFunc("/user/authenticate", UserAuthenticateHandler).Methods("POST")    api.HandleFunc("/user/endsession", UserLogoutHandler).Methods("POST")    api.HandleFunc("/user/profile", UserProfileHandler).Methods("GET")    api.HandleFunc("/user/profile", UserUpdateProfileHandler).Methods("POST")    api.HandleFunc("/user/reset_request", UserResetRequestHandler).Methods("POST")    api.HandleFunc("/user/reset_password", UserResetPasswordHandler).Methods("POST")    api.HandleFunc("/user/loginstatus", UserLoginStatusHandler).Methods("GET")    api.HandleFunc("/forums/directory", ForumsDirectoryHandler).Methods("GET")    api.HandleFunc("/community/list", CommunityListHandler).Methods("GET")    api.HandleFunc("/community/show", CommunityShowHandler).Methods("GET")    api.HandleFunc("/community/create", CommunityCreateHandler).Methods("POST")    api.HandleFunc("/community/edit", CommunityEditHandler).Methods("GET")
查看完整描述

1 回答

?
躍然一笑

TA貢獻1826條經驗 獲得超6個贊

問題是dundundun我在更改之前存儲了具有路徑“/api/1.0/user”的舊cookie,顯然這引起了問題,因為我想,更長或更深的路徑優(yōu)先于較短的根路徑,回想起來,這是完全有道理的。


查看完整回答
反對 回復 2021-07-19
  • 1 回答
  • 0 關注
  • 204 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號