Are there any reasons why Heroku might silently reject requests with status code 400? - heroku

I'm trying to diagnose an issue whereby an embedded device running an HTTP client to issue requests to a Node.js Web application running on Heroku is receiving empty responses with status code 400.
The problem I'm facing is that the presumably failing requests do not even appear in the Heroku logs, so it's certainly not the Web application code returning those 400s.
On the other hand issuing requests to the Web application from a browser works just fine and the requests do appear in the Heroku logs.
I'm trying to figure out whether the embedded client is really sending requests at all and I'm wondering if there are any reasons why Heroku might send back those 400s without the requests even appearing in the logs.

The cause was related to a badly implemented HTTP client in the device that was issuing requests omitting the host header.
Adding the header solved the problem.

Related

Light-4j server stops responding to HTTP GET or POST

I am facing some issue with 1.6.5 version.
Sometimes the server stops replying to my http rest calls. The tcpdump indicated proper tcp hand-shake..and http request going. But no response comes from server.
This is basic http get call and no processing on the server is happening. Server should receive this call and should reply back with 200 OK response.
If I restart the server, it starts working again. This issue is intermittent.
Any pointers would be really appreciated
Thanks for posting the question on this site. It is easier to search than in other places.
When the server stops responding to the exact same request after a while, it is very possible that there are some memory leak or connection leak in the business logic. You can put some debug info on the suspected code block or run the application in debug mode in an IDE. Light-4j application is just a plain Java SE application and you can debug it in the IDE to pinpoint the issue easily.
Thanks for the reply. I my case, the issue might have been synchronized section of business logic. One of the REST call was in the critical section and did not return which resulted in blocking of the new REST calls. I am still watching this issue.
Vikram

Faye chat application failing on web server (bluehost)

This is more of a network question , I believe. Not sure what the issue is. I have a chat application which uses faye and it runs fine on my system(rails app)
with localhost:3000 having faye mounted on it.I recently deployed this rails app onto bluehost server and when I try to use the faye client on browser ,its giving me this error:
WebSocket connection to 'ws://chat.xyz.com/faye' failed: Error during WebSocket handshake: Unexpected response code: 500
The below requests\handshakes keep on repeating.
GET ...chat.xyz.com/faye?message=%5B%7B%22channel%22%3A%22%2Fmet…ing%22%5D%2C%22id%22%3A%221%22%2C%22ext%22%3A%7B%7D%7D%5D&jsonp=jsonp3
GET ...chat.xyz.com/faye?message=%5B%7B%22channel%22%3A%22%2Fmet…ing%22%5D%2C%22id%22%3A%221%22%2C%22ext%22%3A%7B%7D%7D%5D&jsonp=jsonp4
GET ...chat.xyz.com/faye?message=%5B%7B%22channel%22%3A%22%2Fmet…ing%22%5D%2C%22id%22%3A%221%22%2C%22ext%22%3A%7B%7D%7D%5D&jsonp=jsonp5
GET ...chat.xyz.com/faye?message=%5B%7B%22channel%22%3A%22%2Fmet…ing%22%5D%2C%22id%22%3A%221%22%2C%22ext%22%3A%7B%7D%7D%5D&jsonp=jsonp6
GET ...chat.xyz.com/faye?message=%5B%7B%22channel%22%3A%22%2Fmet…ing%22%5D%2C%22id%22%3A%221%22%2C%22ext%22%3A%7B%7D%7D%5D&jsonp=jsonp7
GET ...chat.xyz.com/faye?message=%5B%7B%22channel%22%3A%22%2Fmet…ing%22%5D%2C%22id%22%3A%221%22%2C%22ext%22%3A%7B%7D%7D%5D&jsonp=jsonp8
GET ...chat.xyz.com/faye?message=%5B%7B%22channel%22%3A%22%2Fmet…ing%22%5D%2C%22id%22%3A%221%22%2C%22ext%22%3A%7B%7D%7D%5D&jsonp=jsonp9
GET ...chat.xyz.com/faye?message=%5B%7B%22channel%22%3A%22%2Fmet…ng%22%5D%2C%22id%22%3A%221%22%2C%22ext%22%3A%7B%7D%7D%5D&jsonp=jsonp10
And the failed handshakes\requests keep on getting repeated. Seeing the same on server logs also(except the 500 message obviously). The logs dont give any error apart from these repeats
Is it because of proxy\firewall issue. I recently came across an article :
http://www.infoq.com/articles/Web-Sockets-Proxy-Servers
I am not sure whether its related to blocking of requests by proxy servers.
Tried switching to secure protcol. https. Didn't help.
I use a simple client like this:
var client = new Faye.Client('http://chat.xyz.com/faye');
Any help would be great.

Making request using WebSockets in sails but not receiving response from the server

I'm starting with Websockets and I have a problem.
I have a sails.js application that uses sockets to update the client side.
On the client side it makes an API call using socket.get("/api/v1/actor...") to bring all the items of the database. When I see what the WebSocket's traffic on the Chrome console:
As you can see, the connection has been established and the API call has been correctly done through the socket.
The problem is, there is no answer from the server, not even an error.
If I make the same API call using ajax, I get response, but it doesn't work using WebSockets.
Any idea what might be producing this behavior?
EDIT: I add here the code here that processes the request and this one here that sends the request, but the problem is that it never execute this code. I think we we are closer to the find the cause, since we think it has to do with a network problem. We figured there is an F5 reverse-proxy which is not properly set up to handle websockets
The answer didn't make any sense now that I've seen the code that's why I've edited it. I only answered because I could't comment on your question and ask you for the code.
Your calling code seems correct and the server side of things the process of response should be handled automatically by the framework, you only need to return some JSON in the controller method.
I instantiated a copy of the server (just changed the adapters to run it locally) and the server replied to the web socket requests (although I only tested the route '/index').
Normally when the problems are caused by a reverse proxy the socket simply refuses to connect and you can't even send data to server. Does the property "socket.socket.connected" returns true?
The best way to test is to write a small node application with socket.io client and test it in the same machine that the application server is running, then you can exclude network problems.

gevent-socketio - Error during WebSocket handshake: Unexpected response code: 401

I am working on a pyramid realtime app that would benefit from utilizing websockets. I found that the gevent-socketio library would probably be best for my purposes.
When testing locally on my PC, the websocket transport is used and runs just fine. However, when testing on a server, the handshake fails reporting a 401 response. It then falls back to a long polling transport, which works, but I would really benefit from the speed of websocket.
This makes me believe that there is some kind of authorization issue happening since I am not connecting to the local machine anymore, but I am at a complete loss as to where to look for help.
EDIT:
Now the issue was narrowed down to the fact that we were using mod_proxy, a lighttpd module, to instance the server for development and production. Is there any work around for proxying or do we have to a abandon the idea of server instancing? Ideally we would like to have some way of authorizing users to access our development server, which is how we had it set up with mod_proxy.

HTTP GET requests work but POST requests do not

Our Spring application is running on several different servers. For one of those servers POST requests do not seem to be working. All site functionality that uses GET requests works completely fine; however, as soon as I hit something that uses a POST request (ex. form submit) the site just hangs permanently. The server won't give any response. We can see the requests in Tomcat Manager but they don't time out.
Has anyone ever seen this?
We have found the problem. Our DBA accidentally deleted the MySQL database files on that particular server (/sigh). In our Spring application we use GET requests for record retrieval and the records we were trying to retrieve must have been cached by MySQL. This made it seem as if GET requests were working. When trying to add new data to the database, which we use POST requests to do, Tomcat would wait for a response, which never came, from MySQL.
In my experience if you're getting a timeout error it's almost always due to not having correct ports open for your application. For example, go into your virtual machine's rules and insure port 8080, 8443 or 80, 443 are open for http and https traffic.
In google cloud platform: its under VPC networking -> firewall rules. Azure and AWS are similar.

Resources