Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

411 status error code #16

Closed
pulkitsinghal opened this issue Apr 21, 2013 · 3 comments
Closed

411 status error code #16

pulkitsinghal opened this issue Apr 21, 2013 · 3 comments

Comments

@pulkitsinghal
Copy link

Have the authors of elastic.js ever run into the scenario where a 411 status code is returned while posting data with this client?

<html>
<head><title>411 Length Required</title></head>
<body bgcolor="white">
<center><h1>411 Length Required</h1></center>
<hr><center>nginx/1.1.19</center>
</body>
</html>

Its understandable that the client isn't ready for this and the JSON.parse() method in elastic-node-client.js:208:25 gets confused and the system throws a SyntaxError:

undefined:1
<html>
^
SyntaxError: Unexpected token <
    at Object.parse (native)
    at IncomingMessage.ejs.NodeClient.put (./node_modules/elastic.js/elastic-node-client.js:208:25)

But I'm more curious as to why the client might run into such a situation in the 1st place.

@pulkitsinghal
Copy link
Author

Found a clue so wanted to share:

  1. Nginx rpm install doesn't support chunkin module sous-chefs/elasticsearch#38
  2. And another client with a similar problem: Content-Length header is absent phillro/node-elasticsearch-client#64 ... attempts (but fails I think) to solve the issue by explicitly making sure to set the content-length:
    https://github.com/phillro/node-elasticsearch-client/blob/master/lib/elasticsearchclient/calls/elasticSearchCall.js#L86
  3. How could this be handled in elastic.js?

@pulkitsinghal
Copy link
Author

FYI: I was able to ask my team to push configuration changes to the nginx-servers which include support for chunked transfer-encoding ... so I'm no longer running into this problem when using the elasticjs client.

@jsilveira
Copy link

¿Shouldn't elastic-node-client add the ''Content-Length' header in the post and put functions to make it compatible with servers that don't support chunking? (like older nginx versions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants