Slim 2 behind Apache reverse proxy

Hi,

Some of my colleagues are using Slim v. 2.6.3, and their app is working fine when used directly from client browser to server.

However, if there’s an Apache reverse proxy in the way the client browser reports a 404 not found page for the same Slim URL call.

The reverse proxy is not just for the Slim app (so ‘/’ is for something else), so I set up a specific location for the whole app such as:

<Location /theApp>

This means that the Slim API should be accessed in /theApp/api/.

I believe Slim 4 has a function such as:

$app->setBasePath(‘/theApp’);

However, Slim 2 doesn’t.

What can I try?

{EDIT}

In other words, the following PHP code generates a 404-not found error page on the client browser (the page is being written by Slim’s defaultNotFound() function).

<?php
require 'Slim/Slim.php';
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
$app->run();
?>

If I use the following:

$app->get(
  '/getData',
  function () use ($app) {
    echo "test";
  }
);

then calling index.php?getData yields ‘test’ when connecting directly, but shows the 404-not found page as described above when connecting through Apache reverse proxy.

The following test code works fine if my Apache reverse proxy has the ‘/’ location pointing to the backend HTTP server where the Slim V2 application is running:

<?php
require 'Slim/Slim.php';
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();

echo "PATH INFO: ".$app->request()->getPathInfo()."</br>\n";
echo "Root URI: ".$app->request()->getRootUri()."</br>\n";
echo "Script: ".$app->request()->getScriptName()."</br>\n";
echo "Path: ".$app->request()->getPath()."</br>\n";
echo "URL: ".$app->request()->getUrl()."</br>\n";
echo "IP addr.: ".$app->request()->getIp()."</br>\n";

$app->get(
  '/getThis',
  function () use ($app) {
	echo "got it";
  }
);

$app->run();

?>

However, the same code “fails” if my reverse proxy’s ‘/’ location points to another backend server and ‘/myApp’ points to the Slim V2 app.
The client browser displays the defaultNotFound() message in Slim class.

Manually modifying PATH_INFO in Environment.php doesn’t seem to solve the issue, and I am not sure I can upgrade to Slim V4 yet.

What can I try?