I am having a problem with OAI report. happens that baseURL in OAI is bad-formed, I dont know when and where at process upgrading, I gues that I modified some file and it affected my system, follwing pic show the problem:
I found the solution. The problem is when your OJS instance is behind an APACHE server. When if it is your case then you should change the PKPRequest.inc.php file as next:
function getBaseUrl($allowProtocolRelative = **true**)
{
$_this =& PKPRequest::_checkThis();
$serverHost = $_this->getServerHost(false);
if ($serverHost !== false) {
// Auto-detection worked.
if ($allowProtocolRelative) {
$baseUrl = '//' . $_this->getServerHost() . $_this->getBasePath();
} else {
$baseUrl = $_this->getProtocol() . '://' . $_this->getServerHost() . $_this->getBasePath();
}
} else {
// Auto-detection didn't work (e.g. this is a command-line call); use configuration param
$baseUrl = Config::getVar('general', 'base_url');
}
HookRegistry::call('Request::getBaseUrl', array(&$baseUrl));
return $baseUrl;
}
The problem is because allowProtocolRelative is now true, and $baseUrl = '//' . $_this->getServerHost() . $_this->getBasePath();
The solution is simple, just add âhttps:â to $baseUrl inside IF conditional, like this:
@asmecher, Iâm confused by the link you offered. Did you mean to point at this CrossRef thread, or a perhaps a GitHub link?
@Juan_Pablo_Giron_Rui, for my own clarity, can you confirm my reading? You earlier modified Request::getBaseUrl to default the $allowProtocolRelative parameter from false to true as part of setting up an Apache reverse proxy in front of OJS. This forced protocol-relative links everywhere, including in things like OAI, where the protocol should be explicit, so you effectively forced everything to https: with a second local change. Is that correct?
Dear @ctgraham, that is right. When OJS is behind of Apache, it is necessary set up $allowProtocolRelative parameter to true, otherwise the system will not load propertly. On the other hand, IT department, at my university, recommend to use secure protocols like HTTPS. In my case, the digital certified is implemented over a server that serves all request, but not into self application server, e.g. where OJS is installed. Aforementioned, $baseUrl should be adjusted for generates propertly all URL, like shown in OAI report or e-mails templates.
To get this to work without any code modifications, I would place an SSL certificate on the Apache proxy, and place an SSL certificate (could be self-signed and no cost) on the OJS webserver, and configure an âhttps://â base-url in config.inc.php.
I was glad to find your post. Your solution works well and we adopted it to use with our reverse proxy with SSL.
My question is : apart from URLs within emails and Resource identifier in OAI-PMH (that now display correct URLs with the âhttps://â protocol part),
does this change affect other parts/functionalities in OJS I should test and/or look at closely ?
Hello @Marie-Helene, I am happy for that solution could help you. This solution does not affect other parts or functionalities. Iâve tested for one long month and all is ok.
I came here because maybe I am facing a similar problem. I am running OJS 3.3.0.4.
I would like to validate my OAI, but they look broken at the moment: https://jta.ista-online.org/oai
I am using SSL (https) and mod rewrite in order to have clean urls. Does this interfere maybe?
Best wishes and many thanks,
Leonardo