Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit 899f1fb

Browse files
authored
Fix login to admin console on Safari (#928)
Our Set-cookie was pretty legit: ``` quesma-session=...blah...; Path=/; Expires=Thu, 28 Nov 2024 20:59:59 GMT; Max-Age=2592000; Secure; SameSite=None ``` yet it was enigmatically rejected by Safari. Took me while but it turns out that for `localhost` Safari does not allow `Secure` cookie 😕 So now, `Set-Cookie` will be just `quesma-session=...blah...`. I think for this admin interface it's just fine - at least for now, when we don't really allow custom domains, ssl, etc.
1 parent e716c29 commit 899f1fb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

quesma/quesma/ui/console_routes.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,12 @@ var authKey = securecookie.GenerateRandomKey(64)
264264
var encryptionKey = securecookie.GenerateRandomKey(32)
265265
var store = sessions.NewCookieStore(authKey, encryptionKey)
266266

267+
func init() { // Safari does not allow Secure cookies on localhost
268+
store.Options = &sessions.Options{
269+
Secure: false,
270+
}
271+
}
272+
267273
func authMiddleware(next http.Handler) http.Handler {
268274
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
269275
if !isAlreadyAuthenticated(r) {

0 commit comments

Comments
 (0)