How to pass custom header information in Redirect (Using C Module).

This is a discussion on How to pass custom header information in Redirect (Using C Module). within the Windows Web Servers forums, part of the Web Server and Related Forums category; We have a custom Apche C module to trap the authentication and it redirects all the protected Urls to a ...


Go Back   Usenet Forums > Web Server and Related Forums > Windows Web Servers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-26-2007
Rithwik
 
Posts: n/a
Default How to pass custom header information in Redirect (Using C Module).

We have a custom Apche C module to trap the authentication and it
redirects all the protected Urls to a SSO java application. And I need
to pass additional information to the java application. What is the
best way of passing information from Apache to Java? I thought of
using http headers, but it doesn't appear to be carried over when I
use the REDIERCT status in apache module? Any help in this regard
would greatly appreciated.

Thanks,
- Rithwik.

  #2 (permalink)  
Old 02-26-2007
Nick Kew
 
Posts: n/a
Default Re: How to pass custom header information in Redirect (Using CModule).

On 26 Feb 2007 12:45:13 -0800
"Rithwik" <sudhar.suba@gmail.com> wrote:

> We have a custom Apche C module to trap the authentication and it
> redirects all the protected Urls to a SSO java application. And I need
> to pass additional information to the java application. What is the
> best way of passing information from Apache to Java? I thought of
> using http headers, but it doesn't appear to be carried over when I
> use the REDIERCT status in apache module? Any help in this regard
> would greatly appreciated.


A java application is most likely proxied, which is not the same
thing as a redirect.

But to answer the question in the subject line, when you redirect
from apache, the headers_out table is discarded (which is probably
your problem), but the err_headers_out table is preserved. Use it.

--
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/
  #3 (permalink)  
Old 02-27-2007
Rithwik
 
Posts: n/a
Default Re: How to pass custom header information in Redirect (Using C Module).

On Feb 26, 1:40 pm, Nick Kew <n...@grimnir.webthing.com> wrote:
> On 26 Feb 2007 12:45:13 -0800
>
> "Rithwik" <sudhar.s...@gmail.com> wrote:
> > We have a custom Apche C module to trap the authentication and it
> > redirects all the protected Urls to a SSO java application. And I need
> > to pass additional information to the java application. What is the
> > best way of passing information from Apache to Java? I thought of
> > using http headers, but it doesn't appear to be carried over when I
> > use the REDIERCT status in apache module? Any help in this regard
> > would greatly appreciated.

>
> A java application is most likely proxied, which is not the same
> thing as a redirect.
>
> But to answer the question in the subject line, when you redirect
> from apache, the headers_out table is discarded (which is probably
> your problem), but the err_headers_out table is preserved. Use it.
>
> --
> Nick Kew
>
> Application Development with Apache - the Apache Modules Bookhttp://www.apachetutor.org/


Thanks for your response. But I use err_headers_out to populate the
Header.

Here is the code snippet I use:
apr_table_set(r->err_headers_out, "Location", redirect_address);
apr_table_set(r->err_headers_out, "ipaddr12", "12345");
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "Req URL redirected
to %s", redirect_address);

return HTTP_MOVED_TEMPORARILY ;//OK; HTTP_MOVED_TEMPORARILY;

When I use the "OK" status, I see the custom header "ipaddr12". But
when I use other two redirects I don't see the header info.
FYI: The Location url is being proxied by mod_proxy.

I am having nightmare in getting this done. All I need is a mechanism
to pass some information from Apache module to java application. I
don't want to use the query parameters for obvious reasons. Finally if
passing info thru Header is not possible, I might need a code snippet
to pass it thru Cookie. Since I am a newbie to C and Apache, the code
to create and set cookie, would be greatly useful.

Thanks and greatly appreciate your help,
- Rithwik


 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:47 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0