node.js - Ubuntu + Nodejs + curl: (52) Empty reply from server


I have a nodejs process listening a port on my server:

app.get('/statistic', function(req, res) {

        getStatistic().then(statistic => {


When I try to access it via curl being on the same machine:

curl "<PORT>/statistic"
# or
curl "http://<EXT_IP>:<PORT>/statistic"

I get:

* Empty reply from server
* Connection #0 to host EXT_IP left intact

curl: (52) Empty reply from server

But when I access it via curl from another server I see a successful HTTP response.

I don't override res. Also if I put console.log(statistic) before res.json(statistic), I see that statistic is correct.

What's even more interesting - this setup worked perfectly fine for some time...

UPD: ufw is disabled.

1 Answer: 

Sorry, i find error - in the nodejs code there is a part which parses a file. The file has expanded and the execution of the method takes a long time.

Apparently, it so coincided that when I made a request from a third-party server, the method managed to work out and return data, and when asked from the server itself did not have time.

I found an error when the server stopped returning the result to a third-party server and console.log(statistic) before res.json(statistic) stopped working.

Thank you for your replies!


More Articles

Get Python command line output when called from a bash script

This may be a super simple question. I am calling a Python script on an Lubuntu OS (Cubietruck) via a shell script. This is to automate the process on start up (I want to maintain this process). Is there a simple way to view the output from Python? At the moment the Python script runs in the backgro

shell - Gmail imap can't access folders with space (or other escapted characters) in the title

Lets say i'm connection to via shell>> openssl s_client -connect -crlf>> a1 login asdasdasdasdGetting the list of the folders:>> a1 list "" *Respond:....* LIST (\HasChildren) "/" "github"* LIST (\HasNoChildren) "/" "Wizz&AKA-Ai

realtime data communication between two c++ executeables one windows and other in virtual machine ubuntu

I am running ros to control a robot using ubuntu. But the drivers are available for windows only.I have setup a virtual machine where the robot controller is built on roscppI want pass these values generated using ros to a cpp in should be realtime. data should be flowing back and forth.d

postgresql - Modifying pg_hba.conf

I want to modify the linelocal all all peertolocal all all md5within a shell script. What is the best way to go about this? If I am to search for the line, what string should I be looking for? There are a lot of spaces between each word in the pg_hba.confOr is there a better way at doing this?Thank

c++ - Header location issues while porting Qt code from Windows to Ubuntu

I'm trying to port code written in Qt on Windows to Qt on Ubuntu. The problem I'm facing is that it gives me this error for my ui_windowform.h header:error: QtWidgets/QApplication: No such file or directoryI searched on Google for solutions but didn't find anything relevant. I've also added INCLUDEP

How do I insert PHP variables in a MySQL table?

This question already has an answer here: Reference: What is variable scope, which variables are accessible from where and what are “undefined variable” errors? 3 answers

shell - UNIX: copy entire directory structure and only specific file type

How i can recreate entire directory structure and copy only files with .txt extension if present. I would like to copy the directory or sub-directory even if its empty.

php - Ubuntu Server Virtual Host not redirecting properly

I have installed Web site on my Ubuntu Server. The following things are installed on my Server for running web service. 1) Apache22) PHP53) MySql My main website is redirected to https.Example (changed for security purpose) <VirtualHost *.80>ServerName www.example.comServerAlias

shell - Move output of Find command unix

Im learning unix programming , i want to find all files whose size is greater than 1M an print them into a is my code find. -size +1M -print0 | xargs -I -O '{}' mv '{}' files all sites i have found refer to this one as right one , but it does not work . currently im working on ubuntu

node.js - Not able to run my node app at port 80 on ubuntu 16.04

I want to run my node app at port 80 in ubuntu 16.04. But the moment I'm trying to run my app with npm start its throwing error Port in already in use whereas it's not in use. According to Github Reply, We need root privileges to run on ports below 1048 which is correct.So the moment I'm trying to r