[Solved] Custom domain error ##api.submissions.unkownError## on OJS3.1.1

We did an upgrade from 2.4.8 to 3.1.1 (ex. Ojs.domain.com)
After some difficulties, we finally have almost everything running.
For some of our journals we have custom domains.(ex.: custom.domain.com) For these we have problems when we login and check the submissions:

We get the following 3 errors:
##api.submissions.unkownError##

after checking with developer tools on, we saw that it tries 3 api-call’s to get information from ex. following link: https://custom.domain.com//custom/api/v1/submissions?status=1&searchPhrase=&count=20&offset=0&=1524832825532 while _https://ojs.domain.com/**custom**/api/v1/_submissions?status=1&searchPhrase=&count=20&offset=0&_=1524832825532_ does give a result

As we could let it work without the custom domain (and then the journal name behind), we added some code in the .htaccess file that does a rewrite of the custom domain to the regular. But off course then we get another error that the script is called cross over domains and that fails again (even if we tell that it is allowed in the htacces-file:

Header set Access-Control-Allow-Origin “*”

): “ Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource “

Also we saw that in Edge the working links sometimes doesn’t work. No idea why.

Can someone help us out.
Because of this error we have the following problem:
“the submissions are not displayed not in my queue, unassigned, all active. Nothing is displayed”

I have the same problem, any guide please ???

We are still having this issue. Nobody any idea what’s causing this?

Kind regards,
paul

Hi @paul

Hmmm…
Do you also have the appropriate entries in the OJS config.inc.php file, concerning
base_url[index] and base_url[myJournal] ?

Best,
Bozana

@ajnyga, sorry to involve you, but I believe you also have installation with different domains for different journals and you did not have this problem, correct?

No problem @bozana, but we did not upgrade to 3.1.1 yet. We do have subdomains like name.journal.fi in use, so thanks for letting me know about this possible issue. I will start testing upgrade to 3.1.1.1 next week (right now on vacation)

Great, thanks @ajnyga!
I don’t think that there is any difference between 3.1.0 and 3.1.1 regarding this, but… lets see…
Thanks!
Best,
Bozana

I think I’ve seen this error in some of my local XAMPP test servers, but can not recall in what circumstances it occurred.

the “base_url[index] and base_url[myJournal]” is there in the config.inc.php.
We only tested on 3.1.0 but without the custom domain names … so I don’t know if there is a difference between 3.1.0 and 3.1.1.

Hi @paul

I mean are those options/settings in the config.inc.php properly set? Did you have the same situation in OJS 2.4.8?

What do you mean, that you tested it with 3.1.0?

Thanks!
Bozana

hi bozana,

We had the same situation in 2.4.8., but did’nt have any problems. Before upgrading to version 3 we ran tests in 3.1.0 … but without the custom domains.

Here is our config:
base_url[SCAD] = International Journal Sustainable Construction & Design
base_url[BMGOG] = https://ojs.ugent.be/BMGOG
base_url[hmgog] = Handelingen der Maatschappij voor Geschiedenis en Oudheidkunde te Gent
base_url[OZ] = Oostvlaamse zanten: driemaandelijks algemeen tijdschrift voor volkskunde
base_url[silva] = Silva Gandavensis
base_url[deuilvanminerva] = De Uil van Minerva
base_url[agora] = AGORA Magazine
base_url[jeps] = Journal of European Periodical Studies
base_url[broodenrozen] = Brood & Rozen
base_url[handelingen] = https://ojs.ugent.be/handelingen
base_url[AF] = Afrika Focus
base_url[documenta] = https://documenta.ugent.be
base_url[authorship] = https://www.authorship.ugent.be
base_url[ichmet] = https://ojs.ugent.be/ichmet
base_url[test] = https://ojs.ugent.be/test
base_url[gvg] = Handelingen van het Genootschap voor Geschiedenis
base_url[GT] = Ghendtsche Tydinghen
base_url[VMD] = Van Mensen en Dingen: tijdschrift voor volkscultuur in Vlaanderen
base_url[jhes] = Journal for the History of Environment and Society
base_url[TGTIC] = Tijdschrift voor Geschiedenis van Techniek en Industriële Cultuur
base_url[tic] = Tijdschrift voor Industriële Cultuur
base_url[jolcel] = https://jolcel.ugent.be

After searching and searching we found that this trick solved our problem (but wasn’t needed in ojs 2.4.x)
By adding the following line: RewriteCond %{REQUEST_URI} !api/v1/ in the .htaccess file:

RewriteCond %{SERVER_NAME} ^.custom.domain.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !api/v1/
RewriteRule ^(.
)$ index.php/custom/$1 [L]

Now it seems to work. Thanks for your help!

1 Like

Hi,

The restful_urls = On remove the index.php between localhost/ and /journal and this causes the 404 error.

http://localhost//journal/api/v1/submissions?status=1&assignedTo=-1&searchPhrase=&count=20&offset=0&=15299993396

When I put index.php manually in the request it works fine.

http://localhost/index.php/journal/api/v1/submissions?status=1&assignedTo=-1&searchPhrase=&count=20&offset=0&=15299993396

I don’t know how to repair this error in jQuery request. Could someone help me?

Hi @Gecuimar,

I see you’ve already posted this on another thread. Please don’t double-post; it clutters the forum.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @bozana

An update to this issue. We did run into this with the subdomains. I have updated a new version of our mod_rewrite rules here How to remove index.php in ojs 3.0.2.0 - #15 by ajnyga. They seem to solve the problem with the api calls in subdomains.

Edit: just noticed that @paul has a similar solution above. In our case I could not get it working with a one line solution like that. The difference in our setup is that we use wildcard subdomains.

The XAMPP related problem I mentioned is occurring because of the double slash // in api url. This can be solved by adding these new lines in the mod_rewrite rules before any other rules:

RewriteCond %{REQUEST_URI} ^(.)/{2,}(.)$
RewriteRule (.*) %1/%2 [R=301,L]

I also suddenly started getting this error today (OJS 3.1.1.1), however I didnt make any update or change. Using above 2 lines in mod_rewrite seems working.