Re: What method for Location?

Koen Holtman wrote:
> 
> Yuan John Jiang:
> >
> >I could not find the answer from scanning through the spec.
> >
> >If my client does a "POST URI HTTP/1.1" and the server responds
> >with "Location: NEWURL"
> >What shall my client do next?  Shall I do "POST NEWURL ..."
> >or "GET NEWURL ..."?
> 
> That depends on the status code of the response message the Location is in,
> so you have to look at section 10.3 of the spec.  And note the notes in
> there about what some clients actually do.
> 
> Aside: I believe that if you just output 
> 
> Location: <full URL>
> 
> in a CGI script, the server will send a 302 status code.  To get a 303 status
> code, do
> 
> Location: <full URL>
> Status: 303 See Other

Apache actually requires a "Status: 302" for a simple redirect. It will only
do the redirect without the status if it is an internal redirect (i.e. the
Location starts with '/'). If you do what you suggest you'll get a status of
200 with a Location header, which doesn't get you very far.

Cheers,

Ben.

-- 
Ben Laurie                Phone: +44 (181) 994 6435  Email: ben@algroup.co.uk
Freelance Consultant and  Fax:   +44 (181) 994 6472
Technical Director        URL: http://www.algroup.co.uk/Apache-SSL
A.L. Digital Ltd,         Apache Group member (http://www.apache.org)
London, England.          Apache-SSL author

Received on Tuesday, 11 March 1997 16:30:17 UTC