Forum Moderators: coopster & phranque

Message Too Old, No Replies

Redirecting with POST data

Is this possible without apache mod_perl?

         

alexjc

5:21 pm on Aug 22, 2001 (gmt 0)

10+ Year Member



I had planned to have my perl scripts (which handle all the server updates) redirect to PHP scripts (which handle the querying and displaying).

Get requests not being very sexy, sending parameters to the PHP scripts was supposed to be done using the internal redirect feature of apache. My hosting service, however, thinks that mod_perl is a big security flaw, which leaves me hanging.

Is there any way of redirecting to a different URL with POST data?

It's probably burried in the HTTP specs, but i can't seem to find it.


print "Location: $url\n";
... something needed here ;) ...
print "\n";

littleman

4:21 pm on Aug 23, 2001 (gmt 0)



This should work with all browsers.
print "HTTP/1.0 302 Moved\r\n";
print "Status: 302 Moved\r\n";
print "Location: $url\r\n";

alexjc

10:33 pm on Aug 23, 2001 (gmt 0)

10+ Year Member



Hmmm, I was hoping to modify and append some data along the way.

I found this very good article on the subject, which says it's basically not really possible... or more to the point, you can just about hack it!

[ppeph.gla.ac.uk...]

I think i'll have the perl script call the php itself, and return the content. All i need then is to get the browser to display the second url (not the script's). I'm sure that's in the HTTP doc ;)

littleman

11:18 pm on Aug 23, 2001 (gmt 0)



If you pass the data along from the post in a redirect you are going to have to recycle the data as a GET to the second url - or if the data is small, maybe a cookie.

I believe the excite add-url does a POST redirect to to a GET with a query string, if you want to see how someone else is doing it.
[excite.com...]

alexjc

12:30 am on Aug 26, 2001 (gmt 0)

10+ Year Member



My idea of getting the browser to display the url of the PHP, despite loading from the perl cgi could have worked, if browsers implemented Content-Location according to the specs:


The Content-Location value is not a replacement for the original
requested URI; it is only a statement of the location of the resource
corresponding to this particular entity at the time of the request.

It turns out it doesn't work at all :(

Excite does in fact turn a POST request into a GET, and they use the standard notation (?key=val) in their second page. It looks very amateurish, i'm trying to avoid that ;)

I think your idea of a cookie is the only remaining option...

Thanks for your help.

Alex