freman/caddy-reauth

cookie based auth on subdomain

Opened this issue · 1 comments

It's me again from #1

I have been using your plugin successfully for sub directories as we discussed. Now i would like to tyr to apply it to a subdomain and the syntax is kicking my butt.

this is what i have currently. Have tried it a few different ways but the below is the longest form of what was attempted so everything is there. I know if just going to be a syntax error, just don't know what it might be.

sonarr.domain.com {

	proxy / 127.0.0.1:8989 {
		transparent
	}
	
	proxy /auth-admin https://domain.com/Organizr/auth.php?admin
	proxy /auth-user https://domain.com/Organizr/auth.php?user
	reauth {
		path /
		failure redirect target=https://domain.com/organizr
		upstream url=https://domain.com/organizr/auth-admin,cookies=true
	}
}

edit* when i click on the link it always redirects no matter what. If i pull the reauth block though it loads as expected.

Is the cookie you're setting being set with a domain?

eg

Set-Cookie: name=value; domain=.domain.com
vs
Set-Cookie: name=value

If it's not being set with .domain.com the browser won't send it to the subdomain

Altho, there seems to be some difference of opinion on whether the . is required or detrimental

https://stackoverflow.com/questions/18492576/share-cookie-between-subdomain-and-domain