CGI Redirect with parameters (post method)

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Instead of the following way (get method for the URL),

print $cgi-> redirect(
   -uri => "some-URL?param=$param",

how can I use post method? I don't want to reveal "param=$param".  

I checked perldoc CGI, but not much help.


Re: CGI Redirect with parameters (post method)

Quoted text here. Click to load it

That's not directly possible as 'methods' are used by the client and 'a
redirect' is part of a reply from the server. You can hide the actual
parameters in other ways, eg, you could encrypt the actual query string
using a secret key only known to the server and instruct the client to
pass the encrypted string back to the server using some generic
parameter name. Prior to processing, the server would decrypt what it
got from the client and thus regain the actual parameters.

Re: CGI Redirect with parameters (post method)

Quoted text here. Click to load it

This is an HTTP limitation by design since GET and POST are intended for
different purposes.

As close reading of the 307 redirect spec shows that it can be used for
this, but there is a major usage caveat:

    10.3.8 307 Temporary Redirect
    If the 307 status code is received in response to a request other
    than GET or HEAD, the user agent MUST NOT automatically redirect the
    request unless it can be confirmed by the user, since this might
    change the conditions under which the request was issued.

I have not done (nor seen the results of someone else doing) tests to
check how well browsers adhere to that MUST NOT nor what the UI for the
confirmation would look like.

not sure if that helps

Site Timeline