简体   繁体   中英

Failed to load resource even though it is there

I'm getting a failed to load resource error in my browser console.

http://our-magento-site.com/skin/frontend/blacknwhite/default/js/jquery.parallax-1.1.3.js Failed to load resource: the server responded with a status of 404 (Not Found)

This is only happening on our staging environment, not on my local machine.

When I try to open http://our-magento-site.com/skin/frontend/blacknwhite/default/js/jquery.parallax-1.1.3.js in a browser I'm getting the same 404 error.

I checked and the file exists on our server and I can open it in VIM. The permissions also seem correct and the same as other resources which are loading fine on the page.

ls -al skin/frontend/blacknwhite/default/js/
total 296
dr-x------ 3 www-data www-data  4096 Jul 27 10:03 .
dr-x------ 6 www-data www-data  4096 Jul 27 10:03 ..
-r-------- 1 www-data www-data  3174 Jul 27 10:03 ajaxwishlist.js
-r-------- 1 www-data www-data  5935 Jul 27 10:03 cloud-zoom.1.0.2.min.js
dr-x------ 2 www-data www-data  4096 Jul 27 10:03 configurableswatches
-r-------- 1 www-data www-data 16016 Jul 27 10:03 css3-mediaqueries.js
-r-------- 1 www-data www-data  2394 Jul 27 10:03 html5.js
-r-------- 1 www-data www-data  4233 Jul 27 10:03 jquery.backstretch.min.js
-r-------- 1 www-data www-data  3095 Jul 27 10:03 jquery.cookie.js
-r-------- 1 www-data www-data  8096 Jul 27 10:03 jquery.easing.js
-r-------- 1 www-data www-data 22595 Jul 27 10:03 jquery.fancybox.pack.js
-r-------- 1 www-data www-data 32893 Jul 27 10:03 jquery.iosslider.min.js
-r-------- 1 www-data www-data 37336 Jul 27 10:03 jquery.iosslider.min_rtl.js
-r-------- 1 www-data www-data 15954 Jul 27 10:03 jquery.isotope.min.js
-r-------- 1 www-data www-data 16243 Jul 27 10:03 jquery.isotope.min_rtl.js
-r-------- 1 www-data www-data  1552 Jul 27 10:03 jquery.localscroll-1.2.7-min.js
-r-------- 1 www-data www-data  2235 Jul 27 10:03 jquery.mousewheel.js
-r-------- 1 www-data www-data  1785 Jul 27 10:03 jquery.parallax-1.1.3.js
-r-------- 1 www-data www-data  8112 Jul 27 10:03 jquery.selectbox-0.2.min.js
-r-------- 1 www-data www-data  1762 Jul 27 10:03 jquery.ui.totop.js
-r-------- 1 www-data www-data  6254 Jul 27 10:03 script_ie.js
-r-------- 1 www-data www-data 61109 Jul 27 10:03 script.js
-r-------- 1 www-data www-data  4836 Jul 27 10:03 selectivizr-min.js

Not really sure what could be happening here?

We're running Magento 1.9.2 on an NGINX HHVM server ubuntu 14.04 on an AWS instance.

Ok so while troubleshooting the problem it somehow became solved. I don't quite understand how & why but it now works.

This is what I did, I create a bunch of copies of the file to see if I could access them in the browser.

jquery.parallax-1.1.4.js  # 404 error
jquery.parallax-1.1.js # 404 error
jquery.parallax-1-1-3.js # could access, success
jquery.parallax-1.js # could access, success
jquery.parallax.js # could access, success

Then I checked again and I was now able to access jquery.parallax-1.1.3.js, for some unknown reason the problem went away after creating copies and accessing them in the browser. Maybe it was a Magento URL re-writing issue? I don't know.

When I removed each of these newly copied files the problem re-occurred. then when I created a copy of the file called jquery.parallax-1.js the problem went away again.

将文件权限设置为644,然后再加载。

I was having same issue. I noticed that it's how the file is named. For me /static/version1545416633/adminhtml/Magento/backend/en_US/jquery/jquery-ui-1.9.2.js/jquery-ui-1.9.2.js is the issue.

if you remove the version1545416633 part from the url and create a copy of the file named jquery-ui-1.9.js it will work in a browser as the original filename, but if you keep the version1545416633 in the url then the file needs to be named jquery-ui-1.js ... I assume some kind of htaccess issue.

This issue just decided to start happening after a recent Magento setup:upgrade and di:compile. It makes no sense to me.

I will update this answer if i find the cause.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM