0
I am using Slimframework and I have the following code:
<?php
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use Slim\Http\UploadedFile;
$mid01 = function(Request $request, Response $response, $next): Response{
$response->getBody()->write("BEFORE<br>");
$response = $next($request, $response);
$response->getBody()->write("AFTER<br>");
return $response;
};
$app = new \Slim\App();
$app->post('/file', function(Request $request, Response $response, array $args){
$uploadedFiles = $request->getUploadedFiles();
$response->getBody()->write("API<br>");
return $response;
})->add($mid01);
$app->run();
Then I run the following command to start the server:
/var/www/apiFiles/api$ php -S 0.0.0.0:3131 -t src ./src/api.php
The Server starts normally and I can give a POST through a hostname, such as:
api.empresaXXX.com.br:3131
The point is, when I try to access the route http://api.empresaXXX.com.br:3131/file
, I get the following error:
However, if I give a POST on http://api.empresaXXX.com.br:3131//file
, duplicating the bars, he accesses:
Any suggestions as to how I can proceed in this case?