fix: setting Secure behind nginx
bug was due to having explicit 'serve --http=address' when running behind nginx on NixOS server So either a more complicated check was required, or just setting Secure=true unconditionally. This seems to be a better way, because Firefox already allows secure cookies beng sent and received from localhost for dev purposes, and Chromium does too
This commit is contained in:
13
main.go
13
main.go
@@ -2,8 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"strings"
|
||||
|
||||
"github.com/pocketbase/pocketbase"
|
||||
"sunshine.industries/auth-pocketbase-attempt/middleware"
|
||||
"sunshine.industries/auth-pocketbase-attempt/pages"
|
||||
@@ -12,13 +10,10 @@ import (
|
||||
func main() {
|
||||
app := pocketbase.New()
|
||||
|
||||
servedName := app.Settings().Meta.AppUrl
|
||||
isTlsEnabled := strings.HasPrefix(servedName, "https://")
|
||||
|
||||
middleware.AddCookieSessionMiddleware(app, isTlsEnabled)
|
||||
middleware.AddCookieSessionMiddleware(app)
|
||||
pages.AddPageRoutes(app)
|
||||
|
||||
if err := app.Start(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := app.Start(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user