Coding styles are like assholes, everyone has one and no one likes anyone elses.
Tue, 01/22/2008
19:04
In the past days I had learned what means safe domain resolving. I had acquired this knowledge the hard way and I think I can do justice to my efforts and wasted hours only by sharing the knowledge.
The first encounter with the pain was when I set up a local Wordpress MU installation for tests. Connecting to web server using one level domain (not “localhost” but a name of local network computer) the Wordpress kept denying my access saying that I must enable cookies in my browser.
After many hours of painful trial-and-error (many, many errors) attempts I have stumbled upon Netscape site that describes client side cookie handling. This is a excerpt from the documentation on “domain” part of HTTP cookie directive:
Only hosts within the specified domain can set a cookie for a domain and domains must have at least two (2) or three (3) periods in them to prevent domains of the form: “.com”, “.edu”, and “va.us”. Any domain that fails within one of the seven special top level domains listed below only require two periods. Any other domain requires at least three. The seven special top level domains are: “COM”, “EDU”, “NET”, “ORG”, “GOV”, “MIL”, and “INT”.
And the only thing I had to do was to convince Wordpress not to explicitly set the cookie domain, leaving that to browser. One day of work :-S The second occasion was related to home DNS server that I set up during the weekend. I am sick of connecting to my home network machines using IPs (though some may disagree and say that this is the only orthodox g33k way to do it). Thats why I set up a DNS on my local file server . I intended to use a super domain “home” for local computes but writing home to Firefox it kept resolving it as the webpage of my ISP (btw: I still have no idea why it did that so if anyone does please post a comment and enlighten me). After many hours pointlessly wasted I have used an advice from the web to rather use “local” as my super domain. I can now confirm that that works. And thats it …
Comments
Mon, 03/03/2008 - 16:25 — Jonathan
Thanks Luka... Excelent...
Sat, 03/01/2008 - 01:41 — lukacu
It is a bit of a hack actually. I don't use it in my real world configuration ... just the local sandbox installation.
Open wp-settings.php ... somewhere around the line 297 you will find:
if ( !defined('COOKIE_DOMAIN') )
define('COOKIE_DOMAIN', '.' . $current_site->domain);
What I did was to change the "'.' . $current_site->domain" part with NULL ... that means that the domain is not set, therefore the default domain is used.
Sat, 03/01/2008 - 01:02 — Jonathan
did you fix the problem with the cookies in wordpress? how?
Post new comment