Skip to content

Commit

Permalink
add cookie domain setting option
Browse files Browse the repository at this point in the history
  • Loading branch information
tangbin committed Apr 29, 2020
1 parent b1db63d commit 849d1d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/apigateway/handler/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,11 @@ func saveCookie(w http.ResponseWriter, name, val string, expire time.Time, base6
}
// log.Printf("Set coookie: %s - %s\n", val, valenc)
cookie := &http.Cookie{Name: name, Value: valenc, Path: "/", Expires: expire, MaxAge: maxAge, HttpOnly: false}

if len(options.Options.CookieDomain) > 0 {
cookie.Domain = options.Options.CookieDomain
}

http.SetCookie(w, cookie)
}

Expand Down
1 change: 1 addition & 0 deletions pkg/apigateway/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (

type GatewayOptions struct {
DefaultRegion string `help:"Use default region while region not specific in api request"`
CookieDomain string `help:"specific cookie domain" default:""`

Timeout int `help:"Timeout in seconds, default is 300" default:"300"`

Expand Down

0 comments on commit 849d1d6

Please sign in to comment.