[mod_python] Re: What appears in the browser address window.

Blair P. Houghton blair at houghton.net
Fri Oct 6 14:19:17 EDT 2006

Ronald Levine wrote:
>I have no idea whether this is a mod_python issue, an Apache issue, an
>html issue, or a DNS issue, but here's the problem.  I have a domain,
>call it domainx.com, (not real, at least not mine) and the DNS is
>evidently set up so that www.domainx.com does map to the static IP of
>my office computer.  That is,  when I type www.domainx.com into the
>address window of my browser on some other computer, it does fetch the
>expected page, but when the browser displays that page, it replaces
>the "www.domainx.com" in the address window with the actual IP
>address.  I don't like that, and want to know how to make the browser
>address window continue to show the URL string that was typed into it.

I've never done that before, but I have a couple of ideas
for where I'd start.

First, does that host know its own name?  Check its local
IP config files.  It could be only the routers know who
that is, and translate the IP before it gets there.

Is "www.domainx.com" showing up in the req object, or
is only the IP address there?  Look in req.hostname,
req.interpreter, req.server.server_hostname, and

Try the Redirect config command from mod_rewite.  There's
an example here:


Something like "Redirect permanent / http://www.domainx.com/"
might put the domain name back in the request header and
re-fetch using that.

And here's a handy site that lets you see what the HTTP
contains in both the request and the response.  Not the
same as the info in the req object, but useful to know.


The interesting feature there is that putting, say, "intel.com"
in the box sends a request header with just "intel.com" in the
name, and returns a response header with "www.intel.com", which
something somewhere had to construct from "intel.com".  So this
should tell you exactly what your server is sending, not just
what your browser is showing in the address box.

And again, I bet there's an elegant answer I'm not even


More information about the Mod_python mailing list