Hello,
We upgraded from OJS 3.1.2.4 to OJS 3.2.1.2, we encountered a problem with custom templates. It’s impossible to add new custom template.
We hosts severals journals whith their own domains names. We have rewrite rules in htacess file as follows:
RewriteEngine On
RewriteBase /
RewriteCond %{SERVER_NAME} ^journal-domain1.fr
RewriteRule ^api/v1(.)$ /index.php/journal1/api/v1$1 [R,L]
RewriteCond %{SERVER_NAME} ^journal-domain1.fr
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.)$ /index.php/journal1/$1 [QSA,L]
When we try to add a new custom template, we fill the 3 fields: Email Key, Subject and Body
We click on “Save” button. Window closes. This notification appears: The email template was added.
But the email template was not added!
I made an investigation.
There is nothing special in error log files.
I compared with our test platforme of OJS which not have own domains names and so no rewrite rules in htacess file.
And in this environment, adding new custom templates is working.
I put some trace in some files.
I noticed, that for our production plateform whith own domains names and rewrite rules the function “add(” from the file “/lib/pkp/api/v1/emailTemplates/PKPEmailTemplateHandler.inc.php” was not called.
I looked in the browser console. Response is different in both cases.
In our test platforme of OJS whitout own domains names and no rewrite rules there are:
POST
Scheme: http
Host: journalstest.u-bordeaux.fr
Filename: /index.php/journal1/api/v1/emailTemplates
Adress: XXX.XXX.XXX.XXX:80
State: 202 OK
No Location
In our production platforme of OJS whith own domains names and rewrite rules there are:
POST
Scheme:https
Host: journal-domain1.fr
Filename: /api/v1/emailTemplates
Adress: XXX.XXX.XXX.XXX:443
State: 302 Found
Location: https://journal-domain1.fr/index.php/journal1/api/v1/emailTemplates
With rewrite rules this URL is working:
and refers to this URL:
https://journal-domain1.fr/index.php/journal1/api/v1/emailTemplates
So the difference is there is an HTTP response with status code 302 Found instead of 202 OK.
And I read in online documentation that: “an HTTP response with status code 302 will additionally provide a URL in the header field Location. This is an invitation to the browser to make a second request to the new URL specified in the location field. The end result is a redirection to the new URL.”
Is my problem comes from rewrites rules and the URL redirection which provides a new request to the new URL specified causing an HTTP response with status code 302 ?
Thanks in advance for your answer.
Best regards.
Helene