Yes would only be for subfolder setups, also not sure what to do about leftover cookie
Were any of the recent subfolder changes helpful here on this front?
I donât recall changing anything in this department recently.
7 years later and the _t cookie doesnât have a Path set
running v3.4.2
I host two servers that each run ~15 discourse instances using sub-directories. not having Path set on the _t cookie is a rather large pain point.
DISCOURSE_TOKEN_COOKIE
is also not documented anywhere.
Searching on google has 3 results: this thread, a code link to github where this variable is defined and a 404 link to something called isharkfly
It took me over 6 months to find this thread.
Unfortunately youâre right - the _t
cookie still doesnât have a path associated. Itâs something weâd like to do, but âsubfolderâ installations are fairly rare, and multiple subfolder installations on the same domain are even more rare. So it just hasnât been prioritised.
I took a look at one collection of subfolder sites that we host, and it looks like our workaround has been to rename the cookie for each site on the domain. So, assuming youâre using our standard install YAML files, you would add something like this to each one:
env:
DISCOURSE_TOKEN_COOKIE: _t_mysite
(where mysite
is different for each forum)
Yup. I have now added this. But users are still having issue where they need to re-auth more than they should when switching instances.
But the biggest issue was finding that this was available. I only found it by reading the source and the only way i found this thread was by searching for the exact setting name after i already knew it existed.
Understood. Thanks for posting here about it!
Are the forums public? Could you share some URLs?
They are forums for university courses. So they are private.
The URL format is discourseX.university.url/<year>/<course-name>
And your DISCOURSE_TOKEN_COOKIE
is including both the year and the course name?
Yes itâs _discourse-<year>_<course-name>_t