0

After switching to Nginx, I've noticed a console error "unexpected end of file" in Chrome. The exact same file is fine though if served via Apache though. I tested by loading it from another domain being served by Apache.

The file is "uglified" using grunt uglify and what's interesting is when I skip this, it's parsed fine when served by Nginx. So Nginx seems to be breaking the uglified version only in some way.

jimbo2087
  • 1,034
  • 8
  • 20
  • Chrome will be pointing you at where it thinks the problem is. That information is likely to be a *really big clue*, both to you and to us. Without that information, this question can't really be answered except by guessing. – T.J. Crowder Feb 22 '15 at 12:25
  • The problem is the file is minified so the line number isn't helpful. Then when I un-minified it the issue goes! Very strange... – jimbo2087 Feb 22 '15 at 13:15
  • Right. I'm saying, if you click the error, Chrome will show you the line **and character** where the problem occurs, even if that's character 33,456 on line 1. – T.J. Crowder Feb 22 '15 at 13:22
  • Chrome points to the last characters, it says "unexpected end of file" referring to "}]);" Except that doesn't really help, as those characters need to be there. When I view the minified file on the server, use Javascript Beautify to un-minify it. Without changing any characters, it works.. – jimbo2087 Feb 22 '15 at 17:11
  • does that mean that nginx somehow doesn't serve the whole file? like it stops in the middle ? – Mohammad AbuShady Feb 22 '15 at 20:04
  • Nope, the whole file is being served. I can actually copy and paste the same file contents that are served fine by apache, but when served by nginx it results in a JS error. – jimbo2087 Feb 23 '15 at 10:33

0 Answers0