On Feb 20, 2007, at 4:36 AM, Marc Stern wrote:

How could we use mod_proxy for outgoing connections from another module ?
Is there any simple way ?
Is there any standard (I mean documented) way, or would it rely on internals only ? In the latter case, we would have to recode everything when mod_proxy changes.


You would do something like this:

rr = ap_sub_req_method_uri("OPTIONS", "*", r, NULL); /* this MUST succeed! */
        apr_snprintf(newurl, sizeof(newurl),
                "proxy:%s://%s:%d/%s",
                protocol, sendToIP, sendToPort, myURL);
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                                "query constructed: %s", newurl);
        rr->filename = apr_pstrdup(r->pool, newurl);
        rr->proxyreq = PROXYREQ_REVERSE;
        rr->handler  = "proxy-server";
        ap_run_sub_req(rr);

and then use the response as needed... The above I've used
in some where I'm just interested in getting some backend
header info...

Reply via email to