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.