Submit an Article -> Upload Submission for journal stuck in the file upload step

Hi @dung

Are you in fact seeing any CORS policy messages now, if you look for them in the javascript console?

Best
Jason

I ask because the browser error message will tell you what needs to be remedied.

Hello @jnugent

I tried uploading 2 times with 2 different files A and B:

First case (file A):

I get this error:

image

Second case (file B):

I got no error:

image

Thank you for any help.

Dung.

Yeah, those aren’t CORS violations, they look like errors related to the proxy server. Is it possible to find out what the proxy rules are?

Can you tell me what good question to ask network proxy admin staff?

If the proxying is happening in Apache, it’d be good to know what the ProxyPass and ProxyPassReverse rules are, as well as any potential mod_rewrite rules they may be using.

If you like, and can provide me with an account in one of these installations, I can try working in a test submission and see if I can debug anything further.

How can I contact you, not on here?

I’ve received your emails - I have to run an upgrade for a client in a few minutes but I can look shortly after.

Best
Jason

-Proxy server is not on the same OJS server or happening in Apache, it is University wide proxy server.

-I am going to send your mod_rewrite rules on different chanel

-I am contacting my University Proxy Server admin staff to ask related questions

-I have dev.journalhosting.ucalgary.ca server where it shares the same University Proxy Server but it does not use custom domain and it seems to upload files a bit better - more files can be uploaded on this server but some still fails, you can have access to it if you want. It is a sandbox

Regards,

Dung.

Hi @dung @NateWr

So I am almost positive I know what this is. Dung, your journals that are on custom URLs also remove index.php (as well as the journal path) from the URL using mod_ rewrite and OJS’ support of RESTful URLs. That’s all fine, but you need to be careful with the API calls when you redirect them. This is what is happening, and Nate was correct when he drew attention to the 302 redirect that was occurring when you uploaded a file.

Because your POST requests do not contain index.php or the path (in this case “rcc”) your POST urls look like:

/api/v1/submissions/74533/files

and you have a RewriteRule in the configuration file you sent me of:

    # Rewrite custom domain to make api calls correctly
    RewriteRule ^/(api/.*)$ /index.php/rcc/$1 [R,L]

Which is fine, but by default RewriteRules switch to a GET request, and lose all of your POST material so the reason why the files are not uploading is because all you end up doing is just fetching the /files end point in the API again, on a 302 redirect.

You can see the redirect and the response happen if you just try loading:

https://cjc-rcc.ucalgary.ca/api/v1/submissions/74533/files

In a browser if you are logged in. You’ll see the redirect occur and you’ll just get back some empty JSON.

There is a special HTTP status code of 307 that you can use to force browsers to make the request again, using the original protocol and original post data. I suspect you will get success if you change the rule above to:

    # Rewrite custom domain to make api calls correctly
    RewriteRule ^/(api/.*)$ /index.php/rcc/$1 [R=307,L]

which tells Apache to use the 307 HTTP status code when sending the Location header.

Cheers,
Jason

I should as well point out that a 307 status code is meant to be a “temporary redirect” so this might be a misuse of it. I suspect the long term solution here is to not obfuscate or rewrite your API urls. At PKPPS we do not do this, as it leads to weird problems that are hard to debug.

Cheers,
Jason

Is this what you saw @jnugent an empty array instead of data , I do not see the redirect occurs this time ?

image

Thank you!

I am still digesting your comments.

Dung.

Yes, the redirect occurred. you can see in your screenshot that the URL now has index.php/rcc in it. It did not before.

Best
Jason

1 Like

Changed site-enabled apache virtual host config as your recommendation above works!

image

We are very thankful!

D.

1 Like

Fantastic! Glad that things are working!

Best
Jason

1 Like

@jnugent We can call this file 71007.pdf (i sent you) earlier an exception and move on, but if you can try to upload it you will see it will not upload? What should I look at?

Thank you!

Dung.

Hi @dung that file uploaded successfully for me. I added it to submission id 74378.

Best
Jason

Hello @jnugent

I meant to update you but you tested it :).

Here is a short story how I found out and fix the issue:
"
Hi Dung,

Not sure if this helps but the pdf file 71007 that won’t upload was created using LaTeX and the user says that when they remove the graphics generated in a eps format the file uploads fine. However, because it is a mathematics journal eps graphics are essential for publication.

Thanks,
Kate
"

So I googled and then contacted my network Proxy server F5 admin team and they just quickly allowed content thru filter and that works!

Here is the error when it did not work.

image

Thank you so much Jason and Nate. We really appreciate your work and OJS. All is good now. ticket can be closed.

Have a great evening!

Dung.

2 Likes

This topic was automatically closed after 3 days. New replies are no longer allowed.