[Zope] - making Zope stop inserting a BASE HREF tag?

Jim Fulton jim.fulton@digicool.com
Mon, 18 Jan 1999 09:43:43 -0500


Anthony Baxter wrote:
> 
> Hey there,
> 
> I've got a Zope running under ZopeHTTPServer on an NT4 box - for
> some reason it keeps inserting a BASE href into the HTML it sends
> back. For various reasons, this box's name is not what it's really
> known as - it's proxied in wierd and wonderful ways.
> 
> For example, the following DTML (from standard_html_header)
> <HTML><HEAD><TITLE>
> <!--#var title_or_id-->
> </TITLE></HEAD><BODY BGCOLOR="#FFFFFF">
> 
> gives this:
> 
> <HTML><HEAD><TITLE>Zope</TITLE> <base href="http://TSWITCH:9673/">
> </HEAD><BODY BGCOLOR="#FFFFFF">
> 
> It looks like some code in ZPublisher/Response.py is responsible -
> is there an easy way to fix this, short of taking an adze to that
> section of code? I don't _really_ want to hardcode a base - just to
> let the HTML go straight through, and let the browser figure it out
> itself.

There are many cases where the browser *can't* figure it out
itself.  Consider accessing a folder F that has an index_html:

  http://www.spam.org/X/F

Now the browser will interpret relative references as relative
to X.  But you are *really* accessing: X/F/index_html and
relative references should be relative to: F.  Similar things happen
when you use HTTP methods other that GET and POST, and when
you use the :method form variable feature.  In fact, ZPublisher
*only* sets the base href if it modifies the URL.  In cases like
this, the browser can't get relative references right by itself.

I think that the right way to approach this problem is to get
ZPublisher more involved in the proxying process so that it can
compute the base href properly.

Jim

--
Jim Fulton           mailto:jim@digicool.com
Technical Director   (888) 344-4332              Python Powered!
Digital Creations    http://www.digicool.com     http://www.python.org

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.