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

Proxy response gets truncated #940

Closed
Zeetah opened this issue Jun 24, 2013 · 14 comments
Closed

Proxy response gets truncated #940

Zeetah opened this issue Jun 24, 2013 · 14 comments
Assignees
Labels
bug Bug or defect
Milestone

Comments

@Zeetah
Copy link

Zeetah commented Jun 24, 2013

When i create a proxy routes some of the proxyed files gets truncated and it happens only from time to time. We have loadbalancer with two nodes and its get even worse when we connect through it. It is working better when we connect straight to the node but sometimes not even then.

So if i make like 10 request with curl for example to path /static/js/filename.js which then proxies the request to localhost it breaks at least 5 time with answer:

url: (18) transfer closed with XXX bytes remaining to read .

The route looks like this:

{
            method: 'GET',
            path: '/static/{path*}',
            handler:{
                proxy: {
                    host: '127.0.0.1',
                    port: 8080,
                    protocol: 'http',
                    passThrough: true
                }
            }
}

If i connect straight to the nginx port then it allways comes correctly.

Is there any workaround for this?

We are using node 0.10.8 and Hapi 1.7.3 The static content are server with nginx/0.8.54

@geek
Copy link
Member

geek commented Jun 24, 2013

Please upgrade to Hapi 1.8.1 as this issue is fixed. This is related to an open node bug around the response 'finish' event occasionally firing too early.

@Zeetah
Copy link
Author

Zeetah commented Jun 25, 2013

That seemed to fix the problem. We are testing it now and we will tell you if the problem occurs again.

And thanks to you @wpreul

@Zeetah Zeetah closed this as completed Jun 25, 2013
@Zeetah Zeetah reopened this Jun 26, 2013
@Zeetah
Copy link
Author

Zeetah commented Jun 26, 2013

Hi,

We manage to get the same problem when using https connection. We started using the 1.8.1 version but still in the https connection we get the broken result from time to time.

For example:

curl -O -k https://x.x.x.x/static/js/x.js
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
34 46048 34 15720 0 0 451k 0 --:--:-- --:--:-- --:--:-- 14.9M

curl: (18) transfer closed with 30328 bytes remaining to read

curl -O -k https://x.x.x.x/static/js/x.js
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 46048 100 46048 0 0 964k 0 --:--:-- --:--:-- --:--:-- 43.9M

Is there any way to get around this?

@Zeetah
Copy link
Author

Zeetah commented Jun 26, 2013

I think now that response fires finish event too early with https.

I tried with one hack and get it to work but it is not a real solution for the problem. In stream.js i modified the end functions callback to this:

setTimeout(function() {
callback();
},10);

@geek
Copy link
Member

geek commented Jun 26, 2013

Fixed via a70ece1 I also added a test for https streaming. Please update to 1.8.2 to fix this issue.

Here is the related node issue: nodejs/node-v0.x-archive#5712

@geek geek closed this as completed Jun 26, 2013
@Zeetah
Copy link
Author

Zeetah commented Jul 1, 2013

Could there be a still issue with this? We are experiencing problems with https and phones.. For example with Galaxy S3 Android stock browser and IPhone 4 Safari. Everything works fine on desktop browsers in http and https but at least with these two phones and their browsers we have the same problem as earlier.

@geek
Copy link
Member

geek commented Jul 1, 2013

Are you still experiencing the issue after upgrading to 1.8.2?

@Zeetah
Copy link
Author

Zeetah commented Jul 1, 2013

Yes :(

The update fixed almost everything but the problem occurs in the mobile phones still.

@hueniverse hueniverse reopened this Jul 2, 2013
@geek
Copy link
Member

geek commented Jul 9, 2013

Related: nodejs/node-v0.x-archive@91698f7 and should land in 0.10.13

@geek
Copy link
Member

geek commented Jul 10, 2013

0.10.13 is now released. Please try upgrading as the related tls bug may impact this issue: https://github.com/joyent/node/blob/v0.10.13-release/ChangeLog

@hueniverse
Copy link
Contributor

@toniah Can you confirm the issue is fixed with node 0.10.13?

@ghost ghost assigned geek Jul 12, 2013
@leore
Copy link

leore commented Mar 26, 2014

Hey Eran,

We are getting this same issue and we are on V0.11.12-pre and hapi v2.6. Any idea what else could be causing this problem?

@pon
Copy link

pon commented Mar 26, 2014

@bavidar @hueniverse - this curl command demonstrates the issue we are receiving.
curl command:

 curl -O -k https://api.lob.com/v1/addresses?count=100 -u test_0dc8d51e0acffcb1880e0f19c79b2f5b0cc:

Response:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
 94 56541   94 53248    0     0   259k      0 --:--:-- --:--:-- --:--:--  261k
curl: (18) transfer closed with 3293 bytes remaining to read

@hueniverse
Copy link
Contributor

Can you test it also with node 0.10.26? And with http?

Also, since this issue was part of a release, please open a new issue describing the problem (you can just reference this one).

@lock lock bot locked as resolved and limited conversation to collaborators Jan 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug or defect
Projects
None yet
Development

No branches or pull requests

5 participants