Forum OpenACS Q&A: Re: When using the revproxy module, how to rewrite the form

Thank you very much for your quick response and the detail. I have a similar set up in my config.tcl and the redirection works great.

What I am trying to accomplish is to authenticate using a main NaviServer instance, get the authenticated users person_id and inject that person_id into the original request as it is redirected to another server. In the ns_register_filter call I am using the -url_rewrite_callback switch to include the person_id. Here is my register call

ns_register_filter postauth GET "/pmd/*" ::revproxy::upstream -target "https://another.server.edu" -url_rewrite_callback pmd::rewrite_url

With my rewritten callback looking like the following

nsf::proc pmd::rewrite_url {
    -target -url {-query ""}
} {
    set query "user_id=[ad_conn user_id][expr {$query eq "" ? "" : "&"}]$query"
    append url ?$query
    return $url
}

This works great for a GET request. What I want is to do the same for a POST and PUT request. Since they are not GET requests I do not want to use the query string. I want to push the "user_id=1234" into the body / form of the request that is sent on to the other server.

Is there a way to accomplish this?

Thanks again,

-Tony