You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by James Bromberger <Ja...@jdv.com> on 2001/10/12 08:12:36 UTC

Default Welcome File: redirect or proxy to it?

Hello all,

A quick question on the welcome-file, or as Apache knows it, DirectoryIndex.

I have Tomcat running stand alone behind some Apache servers. Hence, there is no question of using the Apache directive "DirectoryIndex" for this. I am looking at web.xml and seeing the default configuration for welcome file:

    <welcome-file-list>
        <welcome-file>
            index.jsp
        </welcome-file>
        <welcome-file>
            index.html
        </welcome-file>
        <welcome-file>
            index.htm
        </welcome-file>
    </welcome-file-list>


What am noticing is a redirect to the welcome file, in place where Apache would normally do what is almost a proxy to it. The redirect appears to be an absolute redirect to the correct welcome-file, and not a relative one. Is this correct? Should it be an redirect or a 'proxy' (ie, access the default document and return that for the request for '/' so the URL does not change for the client)? Should the redirect be a relative URL (is that permitted in the HTTP spec?)

Here is the response I got when I telnet'ed to Tomcat's HTTP listener (yes, I have it on port 8100):

GET / HTTP/1.0

HTTP/1.0 302 Found
Content-Type: text/html
Location: http://hound:8100/index.jsp 


Now, Remy Maucherat seems to have confirmed this in http://marc.theaimsgroup.com/?l=tomcat-user&m=98531223608091&w=2. 

Having looked quickly at the HTTP spec, I can't see it saying that it must be an absolute URL in the Location: header. Anyone care to comment?

  James

-- 
  James Bromberger,
  Senior Web/Systems Administrator, JDV
  +61 8 9268 2909, +61 417 322 500
  Fax: +61 8 9268 0200

JDV - e-Commerce and Outsourcing Solutions for Financial Services
http://www.jdv.com/

Any securities recommendation contained in this document is unsolicited general information only. Do not act on a recommendation without first consulting your investment advisor to determine whether the recommendation is appropriate for your investment objectives, financial situation and particular needs.
JDV  believes that any information or advice (including any securities recommendation) contained in this document is accurate when issued. However, JDV does not warrant its accuracy or reliability. JDV, its officers, agents and employees exclude all liability whatsoever, in negligence or otherwise, for any loss or damage relating to this document to the full extent permitted by law.


Re: Default Welcome File: redirect or proxy to it?

Posted by "Craig R. McClanahan" <cr...@apache.org>.
See below.

On Fri, 12 Oct 2001, James Bromberger wrote:

> Date: Fri, 12 Oct 2001 14:12:36 +0800
> From: James Bromberger <Ja...@jdv.com>
> Reply-To: tomcat-user@jakarta.apache.org
> To: tomcat-user@jakarta.apache.org
> Subject: Default Welcome File: redirect or proxy to it?
>
>
> Hello all,
>
> A quick question on the welcome-file, or as Apache knows it, DirectoryIndex.
>
> I have Tomcat running stand alone behind some Apache servers. Hence, there is no question of using the Apache directive "DirectoryIndex" for this. I am looking at web.xml and seeing the default configuration for welcome file:
>
>     <welcome-file-list>
>         <welcome-file>
>             index.jsp
>         </welcome-file>
>         <welcome-file>
>             index.html
>         </welcome-file>
>         <welcome-file>
>             index.htm
>         </welcome-file>
>     </welcome-file-list>
>
>
> What am noticing is a redirect to the welcome file, in place where
> Apache would normally do what is almost a proxy to it. The redirect
> appears to be an absolute redirect to the correct welcome-file, and
> not a relative one. Is this correct? Should it be an redirect or a
> 'proxy' (ie, access the default document and return that for the
> request for '/' so the URL does not change for the client)? Should the
> redirect be a relative URL (is that permitted in the HTTP spec?)
>

See HTTP/1.1 Specification (RFC 2616), Section 14.30.  The syntax of the
Location header is:

  Location   = "Location" ":" absoluteURI

In reality, the browser *always* converts relative URIs to absolute ones
when it submits them.  For example, if you have a page at "/foo/bar.html"
that contains this:

  <img src="baz.gif">

then the resulting request from the browser will say

  GET /foo/baz.gif HTTP/1.0

Craig McClanahan