Apache Mod-Python - Fwd: Various musings about the request URL / URI / whatever

This is Interesting: Free IT Magazines  
Home > Archive > Apache Mod-Python > November 2005 > Fwd: Various musings about the request URL / URI / whatever





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Fwd: Various musings about the request URL / URI / whatever
Nicolas Lehuen

2005-11-30, 5:48 pm

2005/11/30, Jorey Bump <list@joreybump.com>:
>
> Finally, I'm getting the impression that most developers are looking for
> a portable way to get the ServerName, as defined in the Apache
> configuration. This may currently be achieved in a variety of ways,
> including:
>
> servername = req.server.server_hostname
>
> or:
>
> req.add_common_vars()
> servername = req.subprocess_env['SERVER_NAME']
>
> So, getting back to Nicolas' original post, and reaffirming Grisha's
> point that req.hostname isn't appropriate in his script, maybe
> req.server.server_hostname will work, in that it allows one to construct
> an URL that gets the user back to the site, even if it doesn't exactly
> match the URL displayed in the browser during the original request.
>
> Does the fact that this is a difficult discovery warrant the addition of
> another high-level attribute, req.servername?



The problem, as I've mentioned in my previous post, is that ServerName does
not mean anything in mass virtual hosting environments, at least in my
current settings (I don't exclude the fact that I've done something wrong).
Using the test script provided in my previous post, the ServerName value is
consistently wrong, always being equal to 'localhost' even if it's not the
virtual host that was requested and serviced.

Anyway, like I've wrote, maybe mass virtual hosting is a stupid idea, all
the more since my production server only has 30 or so virtual hosts, so I
could manage them all by traditional VirtualHost directives... At least with
true VirtualHost directives it's easy to set and use the ServerName value.

Regards,
Nicolas

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com