mod_proxy: Allow reverse-proxy to be set via explicit handler.
Submitted by: ryo takatsuki <ryotakatsuki gmail com>
Reviewed by: ylavic, jim, mrumph
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@
1604378 13f79535-47bb-0310-9956-
ffa450edef68
Changes with Apache 2.4.10
+ *) mod_proxy: Allow reverse-proxy to be set via explicit handler.
+ [ryo takatsuki <ryotakatsuki gmail com>]
+
*) ab: support custom HTTP method with -m argument. PR 56604.
[Roman Jurkov <winfinit gmail.com>]
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
- * mod_proxy: Allow reverse-proxy to be set via explicit handler.
- Submitted by: [ryo takatsuki <ryotakatsuki gmail com>]
- Committed by: jim
- trunk patch: http://svn.apache.org/r1573626
- 2.4.x patch: trunk works
- +1: ylavic, jim, mrumph
- mrumph: Verified on Linux with mod_proxy_fcgi and PHP FPM.
-
* mod_deflate: Fix decompression of files larger than 4GB. According to RFC1952,
Input SIZE contains the size of the original input data modulo 2^32.
PR 56062.
</example>
</section> <!-- /examples -->
+ <section id="handler"><title>Access via Handler</title>
+
+ <p>You can also force a request to be handled as a reverse-proxy
+ request, by creating a suitable Handler pass-thru. For example,
+ the below will pass all PHP scripts to the specified
+ reverse-proxy FCGI server:
+ </p>
+
+ <example><title>Reverse Proxy PHP scripts</title>
+ <highlight language="config">
+<FilesMatch \.php$>
+ SetHandler "proxy:unix:/path/to/app.sock|fcgi://localhost/"
+</FilesMatch&lgt;
+ </highlight>
+ </example>
+ </section> <!-- /handler -->
+
<section id="workers"><title>Workers</title>
<p>The proxy manages the configuration of origin servers and their
struct dirconn_entry *list = (struct dirconn_entry *)conf->dirconn->elts;
/* is this for us? */
- if (!r->proxyreq || !r->filename || strncmp(r->filename, "proxy:", 6) != 0)
+ if (!r->filename) {
+ return DECLINED;
+ }
+
+ if (!r->proxyreq) {
+ /* We may have forced the proxy handler via config or .htaccess */
+ if (r->handler &&
+ strncmp(r->handler, "proxy:", 6) == 0 &&
+ strncmp(r->filename, "proxy:", 6) != 0) {
+ r->proxyreq = PROXYREQ_REVERSE;
+ r->filename = apr_pstrcat(r->pool, r->handler, r->filename, NULL);
+ apr_table_setn(r->notes, "rewrite-proxy", "1");
+ }
+ else {
+ return DECLINED;
+ }
+ } else if (strncmp(r->filename, "proxy:", 6) != 0) {
return DECLINED;
+ }
/* handle max-forwards / OPTIONS / TRACE */
if ((str = apr_table_get(r->headers_in, "Max-Forwards"))) {