Hi
I am running a single journal environment, with RESTful URLs on ojs-3.3.0-7, PHP 7.4.24, Apache 2.4.x in a shared hosting environment.
After logging in to admin panel, file upload requests I send either in the subscriber or management console are sent to /api/v1/_uploadPublicFile, but are being internally redirected to journal contextPath
/cp/api/v1/_uploadPublicFile and returning a 403. If I go to the URL (/cp/api/v1/_uploadPublicFile), I get an api.404.endpointNotFound
I tried going through the various recommendations in issue #4919 but have not found a solution.
config.ini.php
disable_path_info = Off
base_url = "https://www.journalname.com"
base_url[index] = https://www.journalname.com/ojsadmin
base_url[cp] = https://www.journalname.com
.htaccess
RewriteRule ^ojsadmin/(.*)$ index.php/ojsadmin/$1 [PT,QSA,L]
RewriteRule ^cp/api/v1/(.*)$ index.php/cp/api/v1/$1 [PT,QSA,L]
RewriteCond %{SERVER_NAME} ^www\.journalname\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/cp/$1 [PT,QSA,L]
Changing it from [PT,QSA,L] to [L] doesn’t make a difference.
I’ve had had to add the following to index.php to overcome the lack of PATH_INFO variables to fix initial routing, but I don’t believe this related:
if (getenv('ORIG_PATH_INFO')) {
putenv("PATH_INFO=".getenv('ORIG_PATH_INFO'));
}
if ($_SERVER['ORIG_PATH_INFO']) {
$_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
}
if ($_ENV['ORIG_PATH_INFO']) {
$_ENV['PATH_INFO'] = $_ENV['ORIG_PATH_INFO'];
}
My browser includes these requests:
jquery.min.js?v=3.3.0.7:2 XHR finished loading: POST "https://www.journalname.com/api/v1/_uploadPublicFile".
jquery.min.js?v=3.3.0.7:2 XHR finished loading: GET "https://www.journalname.com/api/v1/_uploadPublicFile/".
jquery.min.js?v=3.3.0.7:2 GET https://www.journalname.com/cp/api/v1/_uploadPublicFile 403
jquery.min.js?v=3.3.0.7:2 XHR failed loading: GET "https://www.journalname.com/cp/api/v1/_uploadPublicFile".
Error_logs produce one entry:
[16-Oct-2021 13:08:33 America/Chicago] REQUEST_URI: /cp/api/v1/_uploadPublicFile PATH_INFO: /cp/api/v1/_uploadPublicFile
Any ideas?