Forum OpenACS Q&A: Redirecting to a foreign URL with POST?

Hi all,

I am doing a return redirection like this:

ns_returnredirect "

It seems to me that the redirection is a GET method because the
browser shows the variables strings "?var1=value1&var2=value2" in the
current URL field.

Is there any solution I can do a return redirect with the POST method
so that I keep the variables hidden?

Thanks in advance.

Posted by Bob OConnor on

Hi Kenny,

I asked the same question back in December. This thread:

Has the full discussion of this issue.


Posted by Dave Bauer on
What about util_httppost?
It is in ad_utilties.tcl.preload

from documentation:
proc_doc util_httppost {url formvars {timeout 30} {depth 0} {http_referer ""}}

"Returns the result of POSTing to another Web server or -1 if there is an error or timeout.  formvars should be in the form "arg1=value1&arg2=value2"

This does a post to a URL and returns the contents to the browser.

I was going to use it myself, but my URL I am posting to is HTTPS which does not work.

Posted by Kenny Chan on
Hi Dave,

In fact, I have already tried util_httppost before posting my question. It works. But the way it works is not what I desire. By using util_httppost, aolserver acts as a "proxy browser" and retrieve the target URL and give you back the data where you can set into a string variables for later use (or ns_write back to the client). However, what I really want to do is to actually redirect the client to another URL with the POST method.

Btw, Bob, would you plz gimme some details on how it works? I've read thru the thread you provided but still not quite sure what I should do. Javascript? If so... what Javascript segments are u using? Or have you wrapped things up and created a ns_returnredirect_with_post proc? :~)

Thanks all!