From 43ec360d089afc3725c2aa1552ac94c002f5825d Mon Sep 17 00:00:00 2001 From: Daniel Ponte Date: Sun, 4 Aug 2024 01:53:19 -0400 Subject: [PATCH] Connect works --- pkg/gordio/auth/jwt.go | 3 ++- pkg/gordio/server/routes.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/gordio/auth/jwt.go b/pkg/gordio/auth/jwt.go index cd834ce..bc84034 100644 --- a/pkg/gordio/auth/jwt.go +++ b/pkg/gordio/auth/jwt.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "net/http" + "strings" "time" "golang.org/x/crypto/bcrypt" @@ -115,7 +116,7 @@ func (a *authenticator) routeAuth(w http.ResponseWriter, r *http.Request) { Name: "jwt", Value: tok, HttpOnly: true, - Secure: true, + Secure: !strings.HasPrefix(r.Host, "localhost:"), Domain: a.domain, }) diff --git a/pkg/gordio/server/routes.go b/pkg/gordio/server/routes.go index 214dce7..e1bd602 100644 --- a/pkg/gordio/server/routes.go +++ b/pkg/gordio/server/routes.go @@ -17,7 +17,7 @@ func (s *Server) setupRoutes() { r.Group(func(r chi.Router) { // authenticated routes - r.Use(s.auth.AuthMiddleware(), s.auth.VerifyMiddleware()) + r.Use(s.auth.VerifyMiddleware(), s.auth.AuthMiddleware()) s.nex.InstallPrivateRoutes(r) })