httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "karim Bendadda" <kakib...@gmail.com>
Subject Re: [Apache Module] Request External Redirection
Date Mon, 14 Jan 2008 15:30:15 GMT
Thank you for your help!

How can I call the Redirect directive into the module??, In fact in the
module I have a function that make an LDAP connection I want to do something
like that:

request_rec* my_request; //The request with new information

if(my_function(user_is_defined_in_ldap)==true)

Redirect my_request new_Url

else

Do_nothing

On 1/14/08, Dr. Peter Poeml <poeml@suse.de> wrote:
>
> 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
>
>


-- 
Karim

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message