August 31, 2006

virtual hosts

Posted in Uncategorized at 1:50 pm by anand

Sites like wordpress and blogspot provide domain name for every user. It is quite different from other sites. for example flicker doesnt provide a domain for every user.

Typically the sites which provided domain names gives you the ability to choose the template/layout for your site.

i was trying to undertand how to do this using web.py and lighttpd/apache. This involves two things. first part is configuring DNS server such that it gives same IP address for *.yourdomain.com. second part is write a web application which understands this virtual hosts.

Any typical web application uses the query string of the url to decide what action to perform. In the case of virtual hosts setup, it should also use the servername.

Found a link in web.py wiki with some useful information about how to handle the second part. In that page, HTTP_X_FORWARDED_HOST is used to identify the server name. I just used HTTP_HOST for my purpose and it worked without any problems.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: