Open amibeldev opened 9 months ago
in htdocs/api/index.php
replace current code from line 102:
...
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$url = $_SERVER['PHP_SELF'];
if (preg_match('/api\/index\.php$/', $url)) { // sometimes $_SERVER['PHP_SELF'] is 'api\/index\.php' instead of 'api\/index\.php/explorer.php' or 'api\/index\.php/method'
$url = $_SERVER['PHP_SELF'].(empty($_SERVER['PATH_INFO']) ? $_SERVER['ORIG_PATH_INFO'] : $_SERVER['PATH_INFO']);
}
// Fix for some NGINX setups (this should not be required even with NGINX, however setup of NGINX are often mysterious and this may help is such cases)
if (!empty($conf->global->MAIN_NGINX_FIX)) {
$url = (isset($_SERVER['SCRIPT_URI']) && $_SERVER["SCRIPT_URI"] !== null) ? $_SERVER["SCRIPT_URI"] : $_SERVER['PHP_SELF'];
}
// Enable and test if module Api is enabled
if (empty($conf->global->MAIN_MODULE_API)) {
...
By :
...
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (preg_match('/api\/index\.php$/', $url)) {
$pathInfo = $_SERVER['PATH_INFO'] ?? $_SERVER['ORIG_PATH_INFO'] ?? '';
$url = $_SERVER['PHP_SELF'] . $pathInfo;
}
// Enable and test if module Api is enabled
if (empty($conf->global->MAIN_MODULE_API)) {
....
Bug
When I access the URL https://localhost/api/index.php/explorer/
I encounter several dysfunctions:
1 - Display of the warning: "_Warning: Undefined array key 'ORIG_PATHINFO' in /app/htdocs/api/index.php on line 107" 2 - Unable to retrieve the list of actions: "Can't read from server. It may not have the appropriate access-control-origin settings.""
Environment Version
18.0.4
Environment OS
ubuntu
Environment Web server
Caddy
Environment PHP
8.2
Environment Database
mysql
Environment URL(s)
https://localhost:9943/api/index.php/explorer/
Expected and actual behavior
Steps to reproduce the behavior
No response
Attached files