A few things to note here...

You cannot post to a remote server in this fashion.  You can take a POST
request to your server and convert it to a GET request to another server, 
which may not be what you want.

To take POST content and POST it to another server you must proxy the request.
By proxy, I mean using LWP to make the request to the remote server via POST,
and delivering that returned content back to the user.  

That's the easy part.  Now you'll have to fix all the relative URLs within that
document so that they point to the remote server rather than to your server, 
which is further complicated by things like CSS and Javascript.

Look into libwww-perl (LWP) and HTML::TreeBuilder (for fixing the links).  I'm
sure that there is stuff in this lists' archives which go into more detail on
both of those...

Hope that helps,

Rob

On Mon, Jun 24, 2002 at 12:03:50PM -0400, Ken Y. Clark wrote:
> On Mon, 24 Jun 2002, Kirk Bowe wrote:
> 
> > Date: Mon, 24 Jun 2002 16:22:42 +0100 (BST)
> > From: Kirk Bowe <[EMAIL PROTECTED]>
> > To: [EMAIL PROTECTED]
> > Subject: Preserving POST data on external redirect?
> >
> >
> >
> > Hi all, my content handler does some work with POSTed data, and at the
> > end
> > wants to redirect to a totally unrelated server, preserving the POST data
> > that the client originally sent, so that the unrelated server can do its
> > own further processing with its own mod_perl, cgi, or whatever.
> >
> > I can't get it to work, as I think I'm getting confused by some
> > pre-Apache::Request hints that I've seen for this. This is the mess I've
> > got so far (condensed):
> >
> > sub handler
> > {
> > my $r = Apache::Request->new(shift);
> >
> > ... some calls to other subs here to do work ...
> >
> > $r->method("POST");
> > $r->method_number(M_POST);
> > $r->headers_in->unset("Content-length");
> > $r->args($content);
> > $r->header_out('Location' => "http://j.random.server.com/foo.cgi";);
> > $r->status(REDIRECT);
> > $r->send_http_header;
> >
> > return REDIRECT;
> > }
> >
> > It redirects, but doesn't pass the POST data. I thought it may have been
> > due to the original post data being deleted because I use it, so I tried
> > using Request->instance instead of Request->new, but that made no
> > difference either. Is it actually possible to do it if I'm using the
> > Request object?
> >
> > Cheers
> 
> I think this is what you want:
> 
> 
>http://theoryx5.uwinnipeg.ca/cgi-bin/guide-filter?page=snippets/Redirect_a_POST_Request_Forward.html;query=GET%20POST;match=and;where=all;stem=no
> 
> ky

Reply via email to