XenForo's handing of cookie domains

cmeinck

Well-known member
One of my XenForo forums deals with Windows Phone 7 devices. I have it set up to support Tapatalk. They don't have an official client, but there is an app called Board Express that supports Tapatalk. Now, here's where things get tricky. The Windows Phone Tapatalk forum app Board Express does not support XenForo. I've been in touch with the developer and he's indicated the following as a problem. I'm not a developer, but was hoping I might be able to offer him a solution based on feedback from developers here on the XF forums.

A bigger problem is the wrongly set standard cookie domain set by XenForo. Windows Phone 7 has a very secure implementation of cookie handling, which is ignoring all cookies with not correctly set cookie domains. I’ll have to check how this can be solved. Somewhere in XenForo you should be able to change the cookie domain.

Any suggestions that I might be able to pass along?
 
I can't logging in as user in my test forum because this problem:
"Cookies are required to log in to this site. You will not be able to login until they are accepted."
 
I'm having some problems with this. This is the config.php in Library only or the one in community (xenforo) root as well?

When I insert it in library I get an error:
syntax error, unexpected 'path' (T_STRING), expecting ')' in line .....(long path to the config.php file)

the Line it points to is:
'path' => '/',

Also where do I insert this code? right after <?php ?

Any help would be appreciated!

Was solved, i needed to use:

$config['cookie'] = array(
'prefix' => 'xen_',
'path' => '/',
'domain' => '.domain.com'
);

Not entirely sure what the issue was, could it be that when I copied the code from here it copied with space in front of the three middle lines starting ' ?
 
Last edited:
I'm having some problems with this. This is the config.php in Library only or the one in community (xenforo) root as well?

When I insert it in library I get an error:
syntax error, unexpected 'path' (T_STRING), expecting ')' in line .....(long path to the config.php file)

the Line it points to is:
'path' => '/',

Also where do I insert this code? right after <?php ?

Any help would be appreciated!

Was solved, i needed to use:

$config['cookie'] = array(
'prefix' => 'xen_',
'path' => '/',
'domain' => '.domain.com'
);

Not entirely sure what the issue was, could it be that when I copied the code from here it copied with space in front of the three middle lines starting ' ?

It is library/config.php . Add it to the bottom of the file or anywhere after <?php

The error probably indicates a syntax mistake which you have since corrected.
 
Thanks, is it possible to include two domains in this code?

No.

If you leave the cookie domain empty then your forum cookies will work on any domain which your users use to access the forum. So if you have two domains parked on your site and users use both then a blank cookie domain will allow this to work. But cookies will not cross domains. So if the user logs into one domain and then switches then they will need to login again.

...but the best practice is normally to enforce a single URL for your site.
 
Thanks,
I'm using xF bridged with WP and wanted to have each on their own domain.
When users log into xF they also get logged into WP. Is there any way of doing this?
 
I got the same error message: "Cookies are required to log in to this site. You will not be able to login until they are accepted." and it only happen on mobile... :(

Here is what I added inside the file config.php

// COOKIES WILL ONLY WORK ON www.yoursite.com
$config['cookie'] = array(
'prefix' => 'xf_',
'path' => '/',
'domain' => 'www.bet-clever.com'

What's wrong?
 
I got the same error message: "Cookies are required to log in to this site. You will not be able to login until they are accepted." and it only happen on mobile... :(

Here is what I added inside the file config.php

// COOKIES WILL ONLY WORK ON www.yoursite.com
$config['cookie'] = array(
'prefix' => 'xf_',
'path' => '/',
'domain' => 'www.bet-clever.com'

What's wrong?

Either the client has cookies disabled or the cookies have gone out of scope. If it's a scoping issue then you might be able to fix it by enforcing "www" in the URL (to match your cookie domain):

https://xenforo.com/community/threads/htaccess-non-www-to-www.7105/page-2#post-354635
 
Top Bottom