File tree 3 files changed +11
-0
lines changed
3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -7,3 +7,6 @@ PASSWORD="123"
7
7
8
8
# Path to store sqlite DB file
9
9
DB = " fusion.db"
10
+
11
+ # Allow non-https request
12
+ INSECURE = true
Original file line number Diff line number Diff line change @@ -25,6 +25,13 @@ func (s Session) Create(c echo.Context) error {
25
25
}
26
26
27
27
sess , _ := session .Get ("login" , c )
28
+
29
+ //使用非https请求时,为保证Set-Cookie能正常生效,对Option进行特殊设置
30
+ if conf .Conf .InSecure {
31
+ sess .Options .Secure = false
32
+ sess .Options .SameSite = http .SameSiteDefaultMode
33
+ }
34
+
28
35
sess .Values ["password" ] = conf .Conf .Password
29
36
if err := sess .Save (c .Request (), c .Response ()); err != nil {
30
37
return c .NoContent (http .StatusInternalServerError )
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ var Conf struct {
13
13
Port int `mapstructure:"PORT"`
14
14
Password string `mapstructure:"PASSWORD"`
15
15
DB string
16
+ InSecure bool `mapstructure:"INSECURE"`
16
17
}
17
18
18
19
func Load () {
You can’t perform that action at this time.
0 commit comments