Luke Taylor Luke Taylor - 1 month ago 7
Apache Configuration Question

iOS web app "failed to parse response"

My web app does a simple load of a JavaScript file using

<script type="text/javascript" src="path_to_file.js"></script>
. On my iOS devices, I see a couple issues only when visiting my web app over cellular data, which is very strange to me.

Over cellular data, the first time I visit the page, I see the error:

Failed to load resource: cannot decode raw data


The internet seems to think this issue is related to compression of some sort, but that's clearly not relevant; I'm doing nothing related to compression with any files.

All subsequent times I visit the page, my devices consistently show an error in the console:

Failed to load resource: cannot parse response


in reference to loading the
vis.min.js
file. The file is 610 KB, which is large for a JavaScript file but smaller than many images, so I don't think that's the issue. Visiting the file manually I have no problem.

If I refresh the page 10-20 times, I can get it to work on only one of those tries, and this issue never appears over Wi-Fi.

I debug this issue by turning off wifi on my phone, and then by connecting it to my Mac in order to use the development tools. Looking at the "Network" page, I can see that this file takes more than 5 seconds to load. Other similarly sized files took less than half a second to load.

Slow loading

Looking online, I wasn't able to find anything about the specific error "could not parse response," besides this question (almost a year old). I thought I'd post a new, much more detailed question, in hope of getting a response.

So, what is the meaning of these errors, what causes them, and why do they only occur over cellular data? Most importantly, how can I fix them?

The page in question is http://luke.deentaylor.com/wikipedia/, if anyone would like to try to reproduce the issues.

Answer

Replacing my local files with CDN-hosted copies seemed to fix it. I assume this was a problem with DigitalOcean.