499 error code with nginx plesk for nodejs app - node.js

I have a nodejs app in a ubuntu server. i use plesk for server management.
I am using a url for catching requets from an external api. It sends a webhook to my url for catching information.
I see in my server log, 499 error when this url is requested.
I cannot find any nginx configuration for fixing this problem
Any ideas?
Kind regards

I had similar issues with NGINX recently.
The reason was server timeout - NGINX forwarded request to a backend service (Spring in my case), the backend service timed out.
In my case it was due to "out of memory" exc in Spring Boot app.
So, most probably it's an issue in your node service.

Related

Nginx:504 Gateway Timeout

I am using Nginx as my https server to serve my http content from my node server.
I am also hosting my server on google cloud.
I have been keep getting a 504 Gateway Timeout Error; So I wonder if it is because I didnt set my upstream server (node server) 8080 port open. Then it works. Not so sure if it is the correct way to do it
But then I kept looking other docs or tutorial online. I never see people configure in such way to connect to node server. They mainly only left the port 80 opened. So I wondered if my config in server block causing the 504 gateway problem
----------second update
this is my setting, and the default_server is written by default
but i always see doc have included a variable - server_name ; Actually I dont quite understand this varibale. May I know should I consider it or not for later use, although it works now
Aside, I got an
Server Error from my app.
FetchError: request to https://34.96.213.54:443/search/guest2 failed, reason: self-signed certificate
Why is that it works on chrome,although I get that api directly and postman successfully.
third updated------
About self-signed certificate: You need to buy one or using a free service like https://letsencrypt.org .Beside that your questions are so basic so you have to research more on nginx docs (http://nginx.org/en/docs/http/server_names.html)

502 Exception - Azure Virtual Machine

I have azure virtual machine, hosted angular application which is having NodeJs as a backend.
Sometimes it is throwing 502 exception.
If we refresh the page and try to hit the api then we get response. But, sometimes it throws 502 and tells nothing other than this. We tried capturing IIS logs, there also no info about this exception.
Please help me to resolve this issue.
It is Server Side Problem. Kindly check the proxy or ip you're hitting. 502 Bad Gateway Error, which indicates that a server somewhere within the server stack — specifically, one which is acting as a gateway or proxy itself — received an invalid response from a different server.

Getting net::ERR_CONNECTION_RESET Intermittently with Node API Hosted in IIS using IISNODE

I have a video streaming API developed in Node.js using the Express module.
This API is hosted on my local machine under IIS 8.5 using iisnode module, which makes the IIS as my reverse proxy server and the express (node) as my web server.
When I hit my API URL in the browser, it plays the video for a while and then I get net::ERR_CONNECTION_RESET error.
I get this error after few minutes (approx 7 mins.), but there is no specific time duration observed.
I see below two errors in HTTPERR folder under "C:\WINDOWS\system32\LogFiles\".
2019-05-09 14:55:39 ::1%0 64836 ::1%0 3005 HTTP/1.1 GET /api/videolib/streamvideo?id=f80b4ae0725f11e9b42fcb6803fde91b - 8 Connection_Dropped VideoLibrary.WebAPI.Node
2019-05-10 08:51:02 ::1%0 54848 ::1%0 3005 HTTP/1.1 GET /api/videolib/streamvideo?id=f80b4ae0725f11e9b42fcb6803fde91b - 8 Connection_Abandoned_By_ReqQueue VideoLibrary.WebAPI.Node
I have observed that, I don't get this error at all when I run the API directly under Node.exe thus bypassing the IIS and IISNODE altogether on my local machine.
However, I have no choice but to use IIS and IISNODE in production.
UPDATE:
So, I created an API in .NET equivalent to my node API, and hosted it in the IIS; it works fine without issues of any kind.
Now, I know that there is something weird going on with the iisnode module.
I have tried changing couple of settings in iisnode via web.config, but nothing seems to fix this problem.
Any help on this would be greatly appreciated. Thanks.

Node.js intermittent connection refused in development

When I run my node.js app in development I intermittently see connection refused an about every 2nd or 3rd request. I am not even sending the requests very quickly (about 1 per second). The requests should be completing very quickly as this is an express app with an end-point that is just checking if the content-type is set correctly. Is it likely that I am seeing the issue because I am not proxying the requests through nginx? Nginx would queue the requests; whereas not using nginx would mean that I am just hitting my node.js app directly. I don't see anything in my node.js app's logs that would indicate an error.

Routing requests from IIS to Jetty with isapi_redirect (tomcat connector)

I have installed the isapi_redirect into IIS, and allowed to run.
I have enabled the ajp13 in Jetty and I can telnet to port 8009.
This is my current uiworkermap.properties:
/hudson=jetty
/hudson/*=jetty
If I make a request to "http://localhost/hudson" or any subdirectory I get a 404 error.
All the other urls return the site defined in IIS.
This tells me that the isapi_redirect is looking at the uiworkermap file and trying to redirect correctly.
In the Jetty log and in the isapi_redirect log I don't see any errors.
If I go to http://localhost:8008/hudson I see it correctly.
Do you have any idea what could cause this?
UPDATE: I created a virtual directory with name "Jakarta" that pointed to the isapi_redirect dll like it is said here: http://tomcat.apache.org/connectors-doc/webserver_howto/iis.html
After this step the error changed, now in the browser I see:
Bad Gateway!
There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.
Jakarta/ISAPI/isapi_redirector/1.2.32 ()
In the error log (in debug mode) I can see that it first connects and the request is made but there is no response from jetty, and this error is generated:
[error] ajp_get_reply::jk_ajp_common.c (2118): (jetty) Tomcat is down or refused connection. No response has been sent to the client (yet)
This is the part of the log with the request and error:
https://rapidshare.com/files/3999719393/isapi_redirect_log.txt
Ok, in the end not having any help from stackoverflow users and also reading that in the official Jetty site about ajp13:
It is recommended to NOT use the AJP protocol, and superior
performance and clearer semantics will be achieve using HTTP.
I gave up on ajp and used a great and well documented open source dll to have HTTP proxy functions in IIS, IIRF.
So I would suggest anyone who has similar issues to just use an HTTP proxy instead.

Resources