httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dr. Peter Poeml" <po...@suse.de>
Subject Re: [Apache Module] Request External Redirection
Date Mon, 14 Jan 2008 15:00:37 GMT
On Mon, Jan 14, 2008 at 03:50:25PM +0100, karim Bendadda wrote:
> Thanks for your answer! But I don't understand the second way to implement
> it?? "it can respond with a Location: header and a status of 302."??
> 
> On 1/14/08, Joe Lewis <joe@joe-lewis.com> wrote:
> >
> > karim Bendadda wrote:
> > >          I'm writing a module (MyModule_mod.c) wich has an *HTTP
> > request* as
> > > input . I want to add an information to the request (an integer) and
> > > redirect it to an *external *server ...Did you know any method for doing
> > > this?
> > >
> > >
> >
> > There are two paths.  The server can PROXY to the external server (e.g.
> > grab the result from the external server and then relay that to the
> > client) or it can respond with a Location: header and a status of 302.
> > Figure out which you wanted to do, and if you struggle to implement it,
> > let us know.

In your handler, you would do something like this to implement the latter:

    /* set a "Location:" header and 302 redirect. */

    /* assemble the url by appending the filename to a baseurl */
    uri = apr_pstrcat(r->pool, baseurl, filename, NULL);

    apr_table_setn(r->headers_out, "Location", uri);

    return HTTP_MOVED_TEMPORARILY;

Peter
-- 
"WARNING: This bug is visible to non-employees. Please be respectful!"
 
SUSE LINUX Products GmbH
Research & Development

Mime
View raw message