• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Test Forums Interfere With Live Forums

Dodgeboard

Well-known member
#1
This is something that I've been seeing for awhile. I'm not sure if I have something misconfigured or what I could be doing wrong.

My live forums are located at www.dodgeboard.com/forums
My test forums are located at www.dodgeboard.com/testforums (protected by htaccess)

Both have their own files and separate databases!

If I login to my testforums, and make any change at all (or even an upgrade of my testforums), my URLS become confused on my LIVE forums. All of my registration emails start going out with www.dodgeboard.com/testforums in the URL and when I look in the admincp of the LIVE forums, the URL has changed in some places, but not all. The contact URL changes and the Privacy URL changes but not the BOARD URL. It stays as it should.

Screenshot of my live board after upgrading my testforums:



err.jpg

I know this seems weird.

All I have to do to fix it is change the board URL (to anything) then hit save. Then change it back. Then the URLS correct themselves as follows:

corr.jpg



My testforums (FROM MY TESTFORUMS ADMINCP) settings look to be correct:


testforums.jpg


What could I be missing? Why do these forums in two totally separate directories/databases seem to be intertwined? Now, out of habit, whenever I even visit admincp at my testforums, I always login to my live board to make everything the URLS are OK and to fix them if necessary.

Any help would be appreciated?
 

Attachments

ChemicalKicks

Well-known member
#2
I've noticed I cannot log into my test forum without being logged out of my live forums. When I first attempt to log back into live my password is always rejected as wrong, enter it a second time and it magically works. So you're not the only one.

Perhaps in your case you've misconfigured something in htaccess?
 

Dodgeboard

Well-known member
#3
I wondered about that. And I have the same issue as you have mentioned...getting logged out of both when logging out of one.

My htaccess in my testforums directory is "stock". However, the one at the root level is forwarding traffic to my forums directory:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^dodgeboard.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.dodgeboard.com$
RewriteRule ^/?$ "http\:\/\/www\.dodgeboard\.com\/forums\/index\.php" [R=301,L]

I wouldn't think anything there would conflict or cause this problem.
 
#5
Just checked and I have the same issue, could the problem be that there is no customizable cookie path for multiple forum installations?
 

Kevin

Well-known member
#7
This is something that I've been seeing for awhile. I'm not sure if I have something misconfigured or what I could be doing wrong.
I've noticed I cannot log into my test forum without being logged out of my live forums. When I first attempt to log back into live my password is always rejected as wrong, enter it a second time and it magically works. So you're not the only one.

Perhaps in your case you've misconfigured something in htaccess?
Just checked and I have the same issue, could the problem be that there is no customizable cookie path for multiple forum installations?
Check this post and follow the changes Jake posted to change your cookie prefix...

http://xenforo.com/community/threads/xenforos-handing-of-cookie-domains.15260/

Also, if you're running APC or other cache, as Floris mentioned make sure you also have specified a per site cache prefix as well.
 

Jake Bunce

XenForo moderator
Staff member
#8
I agree with Floris about the cache thing. If you are using a memory cache they must be separate.

Regarding the login problem... with the default cookie settings that problem is normal. Three solutions are:

1) Setup a subdomain for your test forum and install it there. That will avoid cookie conflicts with the default settings.

2) Specify different cookie paths for each forum. Refer to this thread:

http://xenforo.com/community/threads/xenforos-handing-of-cookie-domains.15260/

In your case the settings would be:

Code:
$config['cookie'] = array(
	'prefix' => 'xf_',
	'path' => '/forums/',
	'domain' => ''
);
Code:
$config['cookie'] = array(
	'prefix' => 'xf_',
	'path' => '/testforums/',
	'domain' => ''
);
3) Specify different cookie prefixes for each forum. The prefix is arbitrary, but they must be different for each forum to avoid conflicts:

Code:
$config['cookie'] = array(
	'prefix' => 'xfforums_',
	'path' => '/',
	'domain' => ''
);
Code:
$config['cookie'] = array(
	'prefix' => 'xftestforums_',
	'path' => '/',
	'domain' => ''
);
 

Jake Bunce

XenForo moderator
Staff member
#9
I wondered about that. And I have the same issue as you have mentioned...getting logged out of both when logging out of one.

My htaccess in my testforums directory is "stock". However, the one at the root level is forwarding traffic to my forums directory:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^dodgeboard.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.dodgeboard.com$
RewriteRule ^/?$ "http\:\/\/www\.dodgeboard\.com\/forums\/index\.php" [R=301,L]

I wouldn't think anything there would conflict or cause this problem.
The rules in your /testforums directory should override those from the web root. You can try temporarily removing those rules to see if they are the cause, but they shouldn't be.
 

Dodgeboard

Well-known member
#10
I agree with Floris about the cache thing. If you are using a memory cache they must be separate.

Regarding the login problem... with the default cookie settings that problem is normal. Three solutions are:

1) Setup a subdomain for your test forum and install it there. That will avoid cookie conflicts with the default settings.

2) Specify different cookie paths for each forum. Refer to this thread:

http://xenforo.com/community/threads/xenforos-handing-of-cookie-domains.15260/

In your case the settings would be:

Code:
$config['cookie'] = array(
'prefix' => 'xf_',
'path' => '/forums/',
'domain' => ''
);
Code:
$config['cookie'] = array(
'prefix' => 'xf_',
'path' => '/testforums/',
'domain' => ''
);
3) Specify different cookie prefixes for each forum. The prefix is arbitrary, but they must be different for each forum to avoid conflicts:

Code:
$config['cookie'] = array(
'prefix' => 'xfforums_',
'path' => '/',
'domain' => ''
);
Code:
$config['cookie'] = array(
'prefix' => 'xftestforums_',
'path' => '/',
'domain' => ''
);

I tried method 2, 3, and (both) 2+3 and I still have the same problem. I do have file caching enabled as Kevin mentioned, but it's not APC, since I am on a shared host. I have this in the config.php of both forums:

$config['cache']['enabled'] = true;
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions'] = array(
'caching' => true,
'automatic_serialization' => true,
'lifetime' => 3600,
'cache_id_prefix' => 'xf_'
);
$config['cache']['backend'] = 'File';

Could this be the problem? Should I turn it OFF for both or just the testforums?

EDIT...I think i see the problem now...cache_id_prefix. Testing my theory...
 

Dodgeboard

Well-known member
#11
Yep...You guys steered me in the right direction. Jake's idea fixed my login/logout issues. Changing the cache_id_prefix for the testforums seems to have cut the umbilical cord between the two forums. Thanks to Jake, Kevin and Floris for leading me in the right direction. Seems to work like a charm now. Now the only problem I am having is getting logged out of my live board. After changing the cookie prefix, me (and probably all other members) are stuck "logged in". Clicking on "log out" does nothing. I suspect I will have to tell everyone to clear their cookies. Is there a better way?
 

Jake Bunce

XenForo moderator
Staff member
#12
Also, here is a full list of configurable options for the file cache:

http://framework.zend.com/manual/en/zend.cache.backends.html#zend.cache.backends.file

Yep...You guys steered me in the right direction. Jake's idea fixed my login/logout issues. Changing the cache_id_prefix for the testforums seems to have cut the umbilical cord between the two forums. Thanks to Jake, Kevin and Floris for leading me in the right direction. Seems to work like a charm now. Now the only problem I am having is getting logged out of my live board. After changing the cookie prefix, me (and probably all other members) are stuck "logged in". Clicking on "log out" does nothing. I suspect I will have to tell everyone to clear their cookies. Is there a better way?
That means multiple existing login cookies are in scope as a result of the cookie confusion between the two forums. Telling your users to manually clear their cookies is one option. Changing the cookie prefix should have avoided this. A new cookie prefix will result in the forum not seeing any of the old cookies.
 
F

Floris

Guest
#16
Glad to hear that's the reason. Unique cookie and cache id for each site, is what I always do, keep them short and simple though. NO weird chars, I even avoid numbers.