Apache ProxyPassMatch - two fcgi processes - by query string

Hi,

I would like to send all of my php scripts to be processed by one fcgi process, except for one single, very specific call of the script, which I would like to send to php-fpm, which is another fcgi process.

The one, single call of the php script handled by the php-fpm process can be identified by a query key/value – say, "callback=1". So, for example, if "https://www.domain.com/api/index?callba … herparam=2">https://www.domain.com/api/index?callback=1&otherparam=2" is sent, it should be handled by php-fpm; otherwise, if "callback=1" is not present in the query string, then the request should be handled by the second fcgi process shown below.

I would like to continue to use ProxyPassMatch, however I would like to filter the first fcgi process (see below) for the key/value pair being present.

The two processes are in the virtual host file as shown below. Again, I would like the first fcgi process (the php-fpm process) to apply only if "callback=1" is in the query string (I recognize that currently both are set to apply to all php files - so all will go to the the first match -- i am just showing that way as a start for editing).

Virtual Host Excerpt:


RewriteEngine On

add .php to access file, but don't redirect

RewriteCond %{REQUEST_FILENAME}.php -f

RewriteCond %{REQUEST_URI} !/$

RewriteRule (.*) $1.php [L]

First fcgi – for php-fpm on port 9000 using TCP

ProxyPassMatch ^/(..php(/.)?)$ fcgi://127.0.0.1:9000/home/webmaster/public/domain.com/public/$1

Second fcgi -- for HHVM on port 9001 using TCP

ProxyPassMatch ^/(..php(/.)?)$ fcgi://127.0.0.1:9001/home/webmaster/public/domain.com/public/$1


Thank you in advance.

0 Replies

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct