I’m upgrading my website and it’s using WordPress. I’m using sub-domain cdn for CDN and it needs to be cookieless.

Currently my website is a multi-network of multisites (both are subdirectory installs), with the subdomain www hosting my main music project, and subdomain photo hosting my photography project.

The plugin I’m using for that kind of multi-network is: https://github.com/stuttter/wp-multi-network

I need to use Single Sign-on. And this leads me to a confusion while setting COOKIE_DOMAIN in wp-config.php. I can set like the plugin’s documentation said:

define( 'COOKIE_DOMAIN',     'mydomain.com'        );

but I know this would make cookies served from cdn.mydomain.com.

How can I set COOKIE_DOMAIN in order to serve cookies from only two subdomains www and photo?

Or do I have to use another domain name just for CDN?

2 Answers
2

As cdn.mydomain.com is not part of your WordPress network, it wont be affected by your settings.

The COOKIE_DOMAIN constant should only be used if you want to serve cookies from a single domain for all your sites in the network. If you omit the constant or set it to an empty value, cookies will belong to the domain their requested from. Thats the configuration you want to use for multisite/network environments especially when it comes to different domains.

Leave a Reply

Your email address will not be published. Required fields are marked *