Lukas W.
Well-known member
- Affected version
- 2.0.9
Having some trouble with XenForo not transmitting cookies when not calling to the own domain. I'm running XenForo on example.com and the external instance on blog.example.com. When doing an Ajax call from that external instance, cookies are by default not being transmitted with the request, although it originates from the same domain, and just a different subdomain.
I've counteracted this behaviour by using the following code, but as it might break depending on the target server not allowing it, we need a less hacky and more native solution to get this running in general and not having to build it in on a case by case basis.
I've counteracted this behaviour by using the following code, but as it might break depending on the target server not allowing it, we need a less hacky and more native solution to get this running in general and not having to build it in on a case by case basis.
Code:
<xf:js>
$.ajaxPrefilter( function( options, originalOptions, jqXHR ) {
options.xhrFields = {
withCredentials: true
};
});
</xf:js>