Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase mod cookie expiration time #654

Open
frozenpandaman opened this issue Jan 21, 2024 · 6 comments
Open

Increase mod cookie expiration time #654

frozenpandaman opened this issue Jan 21, 2024 · 6 comments

Comments

@frozenpandaman
Copy link

I have to sign back into mod.php almost every single time I open the page, even if my last visit was only an hour ago. Is there a way to increase the time until the cookie expires?

@crazy4cars69
Copy link

Should be this https://github.com/vichan-devel/vichan/blob/master/inc/config.php#L177

I have to sign back into mod.php almost every single time I open the page, even if my last visit was only an hour ago.

Check if your browser has cookies enabled or check if installed all necessary PHP dependencies, also check if you have this enabled https://github.com/vichan-devel/vichan/blob/master/inc/config.php#L183

@frozenpandaman
Copy link
Author

frozenpandaman commented Jan 25, 2024

@crazy4cars69 My browser has cookies enabled, yeah – this is happening on both mobile and desktop, so I'm fairly sure it's something server-side, not just me. I'm checking the mod cookie in my browser and it indeed being set properly… e.g. signing in now makes one that expires in July.

I haven't overridden $config['cookies']['expire'] or $config['cookies']['httponly'] in my inc/instance-config.php so it should be reading both of those default values from inc/config.php. I'm not exactly sure what that second one is doing though or why it's named that (httponly).

@RealAngeleno
Copy link

Is your ip address changing? Or is cloudflare properly configured to pass through ips?

@frozenpandaman
Copy link
Author

@RealAngeleno Sorry for the super late reply. No, IP address is not changing. Not sure about Cloudflare stuff…

@RealAngeleno
Copy link

Ok that's interesting. Sorry for the very late reply as well. I should try to know more about your own vichan setup and see what's going on.

@perdedora
Copy link
Member

We got this in the beginning. First reason was nginx configuration without setting the visitor's IP from cf. And the second reason was because it was changing between ipv6 and ipv4.

For CF you could fix with (only have ipv4):

	set_real_ip_from 103.21.244.0/22;
	set_real_ip_from 103.22.200.0/22;
	set_real_ip_from 103.31.4.0/22;
	set_real_ip_from 104.16.0.0/13;
	set_real_ip_from 104.24.0.0/14;
	set_real_ip_from 108.162.192.0/18;
	set_real_ip_from 131.0.72.0/22;
	set_real_ip_from 141.101.64.0/18;
	set_real_ip_from 162.158.0.0/15;
	set_real_ip_from 172.64.0.0/13;
	set_real_ip_from 173.245.48.0/20;
	set_real_ip_from 188.114.96.0/20;
	set_real_ip_from 190.93.240.0/20;
	set_real_ip_from 197.234.240.0/22;
	set_real_ip_from 198.41.128.0/17;

	real_ip_header CF-Connecting-IP;

and for the second reason:

#!/bin/sh

curl --request PATCH \
  --url https://api.cloudflare.com/client/v4/zones/<your_zone>/settings/ipv6 \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <api_token>' \
  --data '{"value": "off"}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants