..and a cupful of serverside configuration goodness…

Debugging isnt fun….
But it does have its moments, when you feel you have learnt something new.Like today….

First let me step back a bit and explain ip-domain mapping using host files on Windows. The Hosts file contains the mappings of IP addresses to host names. This file is loaded into memory (cache) at startup, then Windows checks the Hosts file before it queries any DNS servers, which enables it to override addresses in the DNS.[1] The host file is located at ‘C:WINDOWSsystem32driversetchosts’.

Typically, during development, I use host files to map urls for applications under development to the sub-domain of my main site. This allows me to access cookies etc while still running the web-app on my laptop.

While setting up an web-app today I mapped a domain to an ip using my host file, but could not bring the page up no matter how I hard tried. At my wit’s end I called upon our sys-admin and resident Solaris proponent to help me fix this problem. A couple of hours later I was on my way and had a much deeper understanding of server configuration stuff. Before I forget what I learned I figured I may as well save it for posterity by publishing it here.

The problem arose because I was trying to map my domain to an ip of a virtual server. While this is not a big deal (click here to see how Apache does it), there was something weird happening on my machine.
Typically servers, like regular computers, have physical interfaces that connect them to the network. However you can have multiple virtual interfaces each with individually assigned IP addresses on a single physical interface. Within the webserver software, listening sockets were defined and mapped to the IP addresses on our virtual interfaces.
Each of the virtual interfaces are associated with a listening socket and every virtual server instance is bound to that listening socket. Virtual servers themselves can be name based or ip based. IP-based virtual hosts use the IP address of the connection to determine the correct virtual host to serve whereas name based ones use DNS mappings of IPs to decide which host to serve

The behavior I was seeing turned out to be because while the server’s virtual server instances were bound to individual IP addresses, there were also names that identified what was allowed in the host request field sent by a browser. Since I defined a name in my local hosts file that didn’t match a name defined on the server to be associated with the virtual server instance that I tried to reach, the web server sent my browser’s request to its default, or primary instance.

…I am glad its a Friday !

Contextual aggregated pages on Google

This is interesting. After seeing a trailer for the movie “Lady in the Water” I was intrigued enough to do a google search for it. The first result I was taken to was an aggregated page of all online reviews for the movie, its avarage rating and google search pages to top words used in the movie. There was also a textfield on the original result page to search for tickets for the movie by entering my zip code. [link]

I had seen such pages for music artists [link]already on google but this was the first time I saw anything for movies.

Disaster Recovery

If you are a pretty extensively used service, few things can be as bad as having your site go down. Of late a lot of the services I use seem to keep having outages and since most of them proudly display the “beta” badge, the worst you can do is frown a bit and carry on. Its nice , however, when on rare occasions people do add some personality to the otherwise annoying “Service Down” or 404 page. When I went to flickr a few moments back, I saw this page taking another jab at Ted Stevans’ remarks on net neutrality (made infamous by John Stewart. ).

Flickr Down

I love sites with personality.