I've got an app that runs fine locally, but barfs in production. (Classic problem, right?)
In production, the JS isn't firing correctly. When I open up the browser console, I see this error:
net::ERR_CONTENT_LENGTH_MISMATCH
When I look in the network tab of Developer Tools, is shows that it failed on a GET request for text/html.
It's a cryptic error. I've only found two other SO posts that even mention is and they're unsolved. (For the interested: first post and second post)
Any idea (1) what it means or (2) how to resolve it?
I am getting Error: net::ERR_CONTENT_LENGTH_MISMATCH
Have a look at your server logs to determine what the real issue is.
For me the problem lay somewhere between nginx and file permissions:
tail -f /usr/local/var/log/nginx/error.log or run nginx -t to determine your conf location, where you could specify a custom log path.
refresh the asset in your browser, eg http://localhost:3000/assets/jquery/jquery.js
You may see something like this in the logs:
"/usr/local/var/run/nginx/proxy_temp/9/04/0000000049" failed (13:
Permission denied) while reading upstream for file xyz
Heres how I fixed:
sudo nginx -s stop
sudo rm -rf /usr/local/var/run/nginx/*
sudo nginx
According to this bug report, that error occurs when an external resource length does not match the Content-Length header given in the response.
This might occur because of a misconfigured server, or (as a stretch) maybe some BOM characters got put into the file, or maybe even different lines endings (are you writing on a DOS machine and deploying to a UNIX machine?) may cause issues.
Hope this helps.
I had a similar issue when trying to interpret JSON results. It turned out that somewhere along the line an odd character landed in the database - in this instance the culprit was "â??". It is not clear how this value arrived in the database, but it is likely related to HTML encoding issues - "Â" character showing up instead of " " Either way, after removing the odd characters, the problem was solved.
I had similar issue
[crit] 6889#0: *14817 open() "/var/cache/nginx/proxy_temp/3/02/0000000023" failed (13: Permission denied) while reading upstream
it was because Nginx worker process were not able to access folder /var/cache/nginx/proxy_temp/ - I just changed the folder permissions and everything started working
I had similar issue developing locally on MAMP and using Chrome as browser. Same problematic websites on the live servers had no such issues. First I thought it was MAMP that was playing around and I checked settings like PHP versions mismatch, apache version etc., reinstalled, but the issue remained. At the end I just switched to using Brave browser (was delaying the shift to Brave for a while anyway) and that fixed it for me.
Hope this helps.
Related
I was coding and suddenly my mac froze, I couldn't really do much and I force shutdown my mac and after restarting my code won't run saying it can't connect to the database. I checked if psql had any issue and this error message pops up.
"psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory. Is the server running locally and accepting connections on that socket?"
I tried everything to fix even trying to reinstall psql and nothing works. I found a tutorial online saying to check the /usr/local/var/postgres and deleting ostmaster.pid. But I can't find that file anywhere. My /usr/local is also a bit different, I don't have these files var/postgres. I'm freaking out rn :'(
Try checking the environment variables on your pc and check to see if psql is in the path. this make fix the issue
Nvm just fixed it, the file is under homebrew. I deleted it and now everything works again!
I'm trying to run Ghostdriver inside my Openshift server. As i run this command:
./phantomjs --webdriver=15002
It says:
PhantomJS is launching GhostDriver...
[ERROR - 2014-08-01T04:14:21.160Z] GhostDriver - main.fail - {"message":"Could not start Ghost Driver","line":82,"sourceId":139887801789952,"sourceURL":":/ghostdriver/main.js","stack":"Error: Could not start Ghost Driver\n at :/ghostdriver/main.js:82","stackArray":[{"sourceURL":":/ghostdriver/main.js","line":82}]}
$ ./phantomjs --version
1.9.8
Please help me out, I'm getting this error from 10 Days. I searched everything and googled everything. nothing is sorted me out :( I'm much upset :(
Help surely would be appreciated!!
OpenShift doesn't allow binding the localhost address; there is a patch to allow GhostDriver to bind any specified IP (currently it always binds to localhost no matter what), but it still hasn't made it in the PhantomJS source tree and binary distributions.
In order to use PhantomJS + GhostDriver on OpenShift I recompiled it after applying the patch, you can find it here: https://paolobernardi.wordpress.com/2015/02/25/phantomjs-with-ghostdriver-on-openshift/
Check the Port Number while running the below command. Might be your port say 5555 is already in used. So change that if you get this "Could not start Ghost Driver" error
phantomjs --webdriver=5555
From the documentation it looks like you should be able to do something like this:
./phantomjs --webdriver=$OPENSHIFT_NODEJS_IP:15002
You may have to actually type in your ip address there, not sure if that env variable will populate correctly..
http://phantomjs.org/api/command-line.html
--webdriver starts in 'Remote WebDriver mode' (embedded GhostDriver): '[[:]]' (default '127.0.0.1:8910')
I have not been able to make Paolo Bernardi's patch work, I always catched a segmentation fault. So I re-compiled it on an RHEL machine, and this one worked for me: http://christophe-maillard.com/phantomjs-1.9.8.patched/phantomjs.tar.gz
PS: see Trying to run PhantomJS on OpenShift: cannot patch GhostDriver so that it can bind on the server IP address
Make sure the phantomjs process isn't already running
ps -ef | grep phantom
I decided to try out Bolt CMS on my web server, which has happily run several Wordpress sites for a few months now through PHP-FPM.
The site's front end works apparently fine, but the administration section of the site has problems. Every call to static content -- JS, CSS and image files -- results in a 404 (not found) error. What's more, when I look at the NGINX error logs I see that the server tries to access the files from this location:
/usr/share/nginx/
I don't use that directory anywhere in my nginx or bolt configurations! I've done "grep -R '/usr/share' ." in my nginx and bolt configuration directories, with no results returned.
Has anyone had this problem before? where is the /usr/share/nginx/ reference coming from?
Under distributions like RHEL/CentOS (probably others), /usr/share/nginx/ is the location of the default Nginx files. You can grep -R /etc/nginx and that will point you to where.
The usual problem that I encounter (create for my own misery) is that I will create the Nginx virtual host file as something like /etc/nginx/conf.d/example.com instead of /etc/nginx/conf.d/example.com.conf (note the .conf)
I deleted a javascript file from my website and instead of showing 404, even after deleting the cache and restarting my PC, chrome is showing that the file still exists. As is firefox and IE.
How do I get the browsers to update, or is this just my server's fault
If your JS file is public, try to get it with this terminal command:
wget yoursice.com/your/file/path/youfile.js
If it doesn't give you an error, and download your file, mean that the file it's not deleted...
I have facing strange problem. I have deployed images and js file in Apache Tomcat directrory but it is not showing on page and a warning is coming up:
Resource interpreted as Image but transferred with MIME type text/html: "http://localhost:8084/webApp/img/access.jpg".
Earlier it was working fine but now jquery is also not working and the following error is coming up:
Uncaught ReferenceError: jQuery is not defined
Earlier this error message was appearing in Firefox but Chrome was working fine. But now it is showing the error in Chrome as well.
I have also tried to use the absolute path but no success.
<script src="/webApp/jquery-1.7.2.min.js"></script>
<img src="http://localhost:8084/webApp/img/access.jpg"/>
If you are using tomcat, you should locate the resources at $CATALINA_HOME/webapps/ROOT folder. From there, you might have access to the files.
You can check the access permissions from terminal. If you use unix / linux, locate to the folder:
cd $CATALINA_HOME/webapps/ROOT
And execute the command:
ls -la
This means it can be accessed by everyone, so should be available to everyone accessing to the server by browser
drwxr-x**r-x#** 22 user staff 704 11 jun 01:25 .
You could also try changing the permisions, but your server would be unsure:
sudo chmod a+rx webApp/img/access.jpg
Or go to the webApp folder via cd and execute
sudo chmod -R a+rx .
Deppending on your preferences (the last one means giving permission to all resources on webApp folder, what means givving access to all your projects in server, quite unsure...).
Hope it helps somebody.