Zibbp / ganymede

Twitch VOD and Live Stream archiving platform. Includes a rendered and real-time chat for each archive.
https://github.com/Zibbp/ganymede
GNU General Public License v3.0
494 stars 25 forks source link

Invalid Cookie Domain, dropping domain attribute makes api crash. #177

Closed noraemsu closed 1 year ago

noraemsu commented 1 year ago

Hi, \ I'm using cloudflare origin server SSL certs. Certs are set as *.xxxx.com and xxxx.com. So all subdomains get the certs as does the main domain. \ The subdomains are:

api.xxxx.com
cdn.xxxx.com
vods.xxxx.com

\ Vods point to the frontend.

I set the ENV variable COOKIE_DOMAIN to vods.xxxx.com and also tried xxxx.com. Both should have the same certs because of the wildcard. \ For the frontend config I have set the:

COOKIE_DOMAIN=https://vods.xxxx.com
API_URL=https://api.xxxx.com
CDN_URL=https://cdn.xxxx.com

The api subdomain returns Ganymede API. \ For the api config:

FRONTEND_HOST=vods.xxxx.com

\ Everything works from loggin in, adding channels and downloading vods. But when I login I can see in the API logs. And I will get logged out at times.

net/http: invalid Cookie.Domain "https://vods.xxxx.com"; dropping domain attribute or net/http: invalid Cookie.Domain "https://xxxx.com"; dropping domain attribute Depending on what I set for testing. \ I get the same results no matter what browser I use. After a few Cookie.Domain lines in the log the api will crash or shutdown. Got around this temporarily by adding the --restart unless-stopped. \ I've probably just missed something. \ Thanks.

Zibbp commented 1 year ago

Hi, COOKIE_DOMAIN should be applied to the API env vars and should only be the domain, no protocol like so COOKIE_DOMAIN=vods.xxxx.com. The FRONTEND_HOST for the API env can have the protocol set FRONTEND_HOST=https://vods.xxxx.com

All together it should be API:

COOKIE_DOMAIN=vods.xxxx.com
FRONTEND_HOST=https://vods.xxxx.com

Frontend:

API_URL=https://api.xxxx.com
CDN_URL=https://cdn.xxxx.com
noraemsu commented 1 year ago

Yea that worked, thanks again for the quick help.