File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,13 @@ func (app *BootstrapApp) Setup() error {
9999 }
100100
101101 // Get cookie domain
102- cookieDomain , err := utils .GetCookieDomain (app .context .appUrl )
102+ cookieDomainResolver := utils .GetCookieDomain
103+ if app .config .Auth .Standalone {
104+ tlog .App .Info ().Msg ("Standalone mode enabled, automatic authentication for proxied apps will not work" )
105+ cookieDomainResolver = utils .GetStandaloneCookieDomain
106+ }
107+
108+ cookieDomain , err := cookieDomainResolver (app .context .appUrl )
103109
104110 if err != nil {
105111 return err
Original file line number Diff line number Diff line change @@ -115,6 +115,7 @@ type AuthConfig struct {
115115 IP IPConfig `description:"IP whitelisting config options." yaml:"ip"`
116116 Users []string `description:"Comma-separated list of users (username:hashed_password)." yaml:"users"`
117117 UsersFile string `description:"Path to the users file." yaml:"usersFile"`
118+ Standalone bool `description:"Run in standalone mode, do not set cookies for subdomains." yaml:"standalone"`
118119 SecureCookie bool `description:"Enable secure cookies." yaml:"secureCookie"`
119120 SessionExpiry int `description:"Session expiry time in seconds." yaml:"sessionExpiry"`
120121 SessionMaxLifetime int `description:"Maximum session lifetime in seconds." yaml:"sessionMaxLifetime"`
Original file line number Diff line number Diff line change @@ -43,6 +43,15 @@ func GetCookieDomain(u string) (string, error) {
4343 return domain , nil
4444}
4545
46+ func GetStandaloneCookieDomain (u string ) (string , error ) {
47+ parsed , err := url .Parse (u )
48+ if err != nil {
49+ return "" , err
50+ }
51+
52+ return parsed .Hostname (), nil
53+ }
54+
4655func ParseFileToLine (content string ) string {
4756 lines := strings .Split (content , "\n " )
4857 users := make ([]string , 0 )
You can’t perform that action at this time.
0 commit comments