XF 2.1 Cookies Related to Production Site versus Test Site

Hi again.

I found a thread that sort of deals with the topic of cookies related to production sites versus test sites and a link to the XF 2 manual which I read. However, I still have questions (I'm a newb BTW).

So, here's what I have:
  • My production forum is in mysite/forum/
  • My test site is in mysite/testxen1/
The config.php for both either/both does not have a cookie declaration - simply the default config populated with the correct specifics regarding database and credentials.

<?php
$config['db']['host'] = 'localhost';
$config['db']['port'] = 3306;
$config['db']['username'] = '';
$config['db']['password'] = '';
$config['db']['dbname'] = '';
$config['db']['socket'] = null;
$config['fullUnicode'] = true;
As I suspect that users are being bumped out of a logged in state because of a cookie issue, does that mean that a cookie statement needs to be added to both configs?

Thanks
Frank
 
@AndyB @Hoffi It seems I need additional clarification.

I had a look in the browser Developer Tools at cookies while on the XF main page for my install and I see a few xf_ cookies:
xf_csrf
xf_session
xf_user.

So, If I am understanding correctly, I need to add to the config for my production and test sites something like?:

For my production site
$config['cookie']['prefix'] = 'xf_crprod';

My test site
$config['cookie']['prefix'] = 'xf_crtest';

AND, after I do this, any member who had selected "stay logged in" would have to log in on the next visit?

thanks

Frank
 
Last edited:
I need to add to the config for my production and test sites something like?:

For my production site
$config['cookie']['prefix'] = 'xf_crprod';

My test site
$config['cookie']['prefix'] = 'xf_crtest';
Because your sites are on the same domain, I'd also recommend you use the cookie-path directive too. Thus,

Production:
$config['cookie']['prefix'] = 'xf_crprod_';
$config['cookie']['path'] = '/forum/';

Test:
$config['cookie']['prefix'] = 'xf_crtest_';
$config['cookie']['path'] = '/testxen1/';

AND, after I do this, any member who had selected "stay logged in" would have to log in on the next visit?
Correct. https://xenforo.com/xf2-docs/manual/config/#cookie-settings
 
Back
Top Bottom