404 on /src/handlers/*.js (javascript assets)
-
Why is this plugin telling my browser to load these assets?
- /src/handlers/distance.js
- /src/handlers/time.js
- /src/handlers/altitude.js
- /src/handlers/slope.js
- /src/handlers/speed.js
- /src/handlers/acceleration.js
That
/src/
is the relative path. As in, it’s trying to loadexample.com/src/handlers/distance.js
. And, yeah, that file doesn’t exist. So my server returns a 404.I can’t easily reproduce this. I was trying to generate a map with elevation profile. I was playing with
[elevation-track]
and then[elevation]
and then[sgpx]
. At some point wordpress added a<br />
into my shortcodes. I removed it, saved, and then the page’s elevation charts all disappeared. I checked the js console and found that it was failing to load the javascript files above, getting a 404 back from the server. I tried restoring the wordpress post to an older version, but the same problem exists — the elevation half of the map is missing, and the web browser is failing to load these javascript assets.Has anyone else experienced this? Any idea why wordpress is giving the wrong path to these javascript assets?
-
fwiw, here’s two maps that I have on my wordpress post
[leaflet-map fitbounds zoom=6 zoomcontrol doubleClickZoom scrollwheel dragging !detect-retina][fullscreen][elevation gpx="https://www.eco-libre.org/wp-content/files/ecuador-bike-trip_quito-ambato.gpx"]
[leaflet-map height="1"][sgpx gpx="/wp-content/files/ecuador-bike-trip_quito-ambato.gpx" download=0 waypoints=0 summary="1" summarytotlen=1 summarymaxele=true][layerswitch providers="OpenTopoMap,CyclOSM,Esri.WorldImagery,MtbMap,WaymarkedTrails.hiking"]It was working fine 30 minutes ago, but now the same shortcodes produce a map without any elevation half. And the 404 errors (as described above)
It’s also worth mentioning that the map itself loads fine, and so do many other js assets (which are not given to the client with an invalid URL):
For example, these javascript assets load fine (200):
- /wp-content/plugins/extensions-leaflet-map/leaflet-plugins/leaflet-gesture-handling-1.4.4/dist/leaflet-gesture-handling.min.js
- /wp-content/plugins/extensions-leaflet-map/leaflet-plugins/leaflet.fullscreen/Control.FullScreen.js
- /wp-content/plugins/extensions-leaflet-map/leaflet-plugins/leaflet-providers/leaflet-providers.js
- /wp-content/plugins/extensions-leaflet-map/leaflet-plugins/Leaflet.Control.Opacity/L.Control.Opacity.js
- /wp-content/plugins/extensions-leaflet-map/leaflet-plugins/leaflet-gesture-handling-1.4.4/dist/locales/en.js
Here’s some snippets from the js console. Note that the “disallowed MIME type” errors are red herrings. The real issue is that the “text/html” was a “404” message.
[leaflet-map zoomcontrol ][elevation gpx="/wp-content/files/ecuador-bike-trip_quito-ambato.gpx" marker="position-marker" waypoints="0" downloadLink="0"][fullscreen] www.eco-libre.org:146:19
...
dragging, scroll, mobile true true false www.eco-libre.org:278:2270 enabled www.eco-libre.org:278:416
dragging, scroll, mobile true true false www.eco-libre.org:278:2271 enabled www.eco-libre.org:278:416
dragging, scroll, mobile true false false 2 www.eco-libre.org:278:227GET
https://www.eco-libre.org/src/handlers/distance.jsNS_ERROR_CORRUPTED_CONTENTGET
https://www.eco-libre.org/src/handlers/time.jsNS_ERROR_CORRUPTED_CONTENTGET
https://www.eco-libre.org/src/handlers/altitude.jsNS_ERROR_CORRUPTED_CONTENTGET
https://www.eco-libre.org/src/handlers/slope.jsNS_ERROR_CORRUPTED_CONTENTGET
https://www.eco-libre.org/src/handlers/speed.jsNS_ERROR_CORRUPTED_CONTENTGET
https://www.eco-libre.org/src/handlers/acceleration.jsNS_ERROR_CORRUPTED_CONTENT
...
Loading module from “https://www.eco-libre.org/src/handlers/distance.js” was blocked because of a disallowed MIME type (“text/html”). www.eco-libre.org
Loading failed for the module with source “https://www.eco-libre.org/src/handlers/distance.js”. www.eco-libre.org
Uncaught (in promise) TypeError: error loading dynamically imported module: https://www.eco-libre.org/src/handlers/distance.js 2
Loading module from “https://www.eco-libre.org/src/handlers/time.js” was blocked because of a disallowed MIME type (“text/html”). www.eco-libre.org
Loading failed for the module with source “https://www.eco-libre.org/src/handlers/time.js”. www.eco-libre.org
Loading module from “https://www.eco-libre.org/src/handlers/altitude.js” was blocked because of a disallowed MIME type (“text/html”). www.eco-libre.org
Loading failed for the module with source “https://www.eco-libre.org/src/handlers/altitude.js”. www.eco-libre.org
Loading module from “https://www.eco-libre.org/src/handlers/slope.js” was blocked because of a disallowed MIME type (“text/html”). www.eco-libre.org
Loading failed for the module with source “https://www.eco-libre.org/src/handlers/slope.js”. www.eco-libre.org
Loading module from “https://www.eco-libre.org/src/handlers/speed.js” was blocked because of a disallowed MIME type (“text/html”). www.eco-libre.org
Loading failed for the module with source “https://www.eco-libre.org/src/handlers/speed.js”. www.eco-libre.org
Loading module from “https://www.eco-libre.org/src/handlers/acceleration.js” was blocked because of a disallowed MIME type (“text/html”). www.eco-libre.org
Loading failed for the module with source “https://www.eco-libre.org/src/handlers/acceleration.js”. www.eco-libre.org
...
Source map error: Error: request failed with status 404
Resource URL: https://www.eco-libre.org/wp-content/uploads/leaflet/leaflet.js
Source Map URL: leaflet.js.mapWhy is this plugin telling my browser to load these assets?
- /src/handlers/distance.js
- /src/handlers/time.js
- /src/handlers/altitude.js
- /src/handlers/slope.js
- /src/handlers/speed.js
- /src/handlers/acceleration.js
That
/src/
is the relative path. As in, it’s trying to loadexample.com/src/handlers/distance.js
. And, yeah, that file doesn’t exist. So my server returns a 404.These are for elevation. The right path should be from /wp-content/plugins/extensions-leaflet-map/leaflet-plugins/leaflet-elevation-2.5.1/. Why these files are not loading from this path – I don’t see this. My first guess was a caching plugin, but that you seems not use. So I need more informations. Do you have an URL to a test page?
It was working fine 30 minutes ago,
What have you changed during this time?
What have you changed during this time?
I wish it were so easy. Today I was trying to prepare an example public page for you. At some point, I did get the elevation chart to appear on half the map again, but then it disappeared again. Even when I revert to the known-good file page contents, it’s still missing.
I don’t know if this is a race condition at the time the page is saved or what — but it doesn’t appear to be reproducible depending on the contents of the wordpress post/page.
Anyway, here’s an example page:
The contents of the page is:
[leaflet-map fitbounds zoom=6 zoomcontrol doubleClickZoom scrollwheel dragging !detect-retina][fullscreen][elevation gpx="https://www.eco-libre.org/wp-content/files/ecuador-bike-trip_quito-ambato.gpx"]
Enable mime type in nginx mime.types:
application/gpx+xml gpx
I left for many hours, came home, refreshed the page, and the elevation charts are back again. I didn’t change anything.
Would missing MIME types cause such intermittent, unpredictable behaviour — where the elevation charts appear and disappear over time, without any changes to the server?
After posting the message above, I refreshed the page, and the elevation charts disappeared again. I refreshed several times, and they did not come back again.
I added the line to
/etc/nginx/mime.types
application/gpx+xml gpx;
…and reloaded the nginx config. Then I refreshed the page, and the elevation charts are still missing.
I *restarted* the nginx process, and created a new VM with a freshly installed version of chromium. I loaded the page, and the elevation charts are still missing.
I want to reiterate that the following errors in the JS console:
X was blocked because of a disallowed MIME type (“text/html”)
…are because the server is returning a 404 error as HTML. It is not an issue with MIME types. It’s an issue with the javascript files not existing in
/src/handlers/
You have optimized some js files: /wp-content/plugins/extensions-leaflet-map/leaflet-plugins/leaflet.fullscreen,_Control.FullScreen.js+leaflet-elevation-2.5.1,_dist,_leaflet-elevation.min.js+Leaflet.i18n,_Leaflet.i18n.js.pagespeed.jc.fg9xcbTYXA.js
elevation
in particular is very sensitive when something like this is done. Exclude the elevation javascript files!I added this to my apache’s vhost config (to disable mod_pagespeed for files matching
*elevation.*.js
), and then I reloaded apache.# disable mod_pagespeed on leaflet-map elevation javascript files to prevent
# the chart from disappearing
# * https://wordpress.org/support/topic/404-on-src-handlers-js-javascript-assets/#post-18242197
<Location "/">
ModPagespeedDisallow "*elevation.*.js"
</Location>I refreshed the page, and the charts appear. So far so good. I’ll update this if the issue becomes intermittent again.
Thanks for your help 🙂
-
This reply was modified 2 months, 2 weeks ago by
maltfield.
- You must be logged in to reply to this topic.