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

Not found because of proxy error: Error: socket hang up #94

Closed
jromerob opened this issue Nov 8, 2017 · 12 comments
Closed

Not found because of proxy error: Error: socket hang up #94

jromerob opened this issue Nov 8, 2017 · 12 comments

Comments

@jromerob
Copy link

jromerob commented Nov 8, 2017

I'm trying to get indications of a walk route quering the Cartociudad service. The service url is ok and responds with a JSON with all the indications.

Testing the service URL in my navigator the result is ok but in my Angular app when i try
http.get("http://127.0.0.1:8123/http://www.cartociudad.es/services/api/route?orig=40.44184877149766,-3.5748567877248845&dest=41.36999441400242,2.1469160601647803&locale=es&vehicle=WALK") the result is a 404 NOT FOUND. Response._body is "Not found because of proxy error: Error: socket hang up"

Trying with other proxy the result is OK. Any ideas ?

Thanks.

Current proxy.js
var host = process.env.PORT ? '0.0.0.0' : '127.0.0.1';
var port = process.env.PORT || 8123;

var cors_proxy = require('cors-anywhere');
cors_proxy.createServer({
originWhitelist: [], // permite todos los orígenes
requireHeader: [],
removeHeaders: ['cookie', 'cookie2'],
setHeaders : {
"x-powered-by": "CORS Anywhere"
}
}).listen(port, host, function() {
console.log('Ejecutando proxy en ' + host + ':' + port);
});

System INFO
| request http://www.cartociudad.es/services/api/route?orig=40.44184877149766,-3.5748567877248845&dest=41.36999441400242,2.1469160601647803&locale=es&vehicle=WALK
| node 6.11.1
| npm 3.10.10
| Operating System Windows 10

@Rob--W
Copy link
Owner

Rob--W commented Nov 8, 2017

Trying with other proxy the result is OK.

Is this proxy also running on localhost?

@jromerob
Copy link
Author

jromerob commented Nov 8, 2017

Yes, the proxy is on localhost (127.0.0.1:8123).

This is the Chrome console output:

image

@Rob--W
Copy link
Owner

Rob--W commented Nov 8, 2017

Not CORS Anywhere, the other proxy that is working according to you. I am asking in order to determine whether the issue is specific to CORS Anywhere, or specific to your local setup (e.g. your IP is blocked by that other site, or your firewall has blocked outbound connections).

@jromerob
Copy link
Author

jromerob commented Nov 8, 2017

Oh, sorry !. No, the other proxy isn't on localhost. But CORS Anywhere is working ok in other request in the same app. the error occurs only in that request.

This is a right request made by the same app throught CORS anywhere running at localhost
image

@Rob--W
Copy link
Owner

Rob--W commented Nov 8, 2017

When you use another program to send the request to the destination, with the same request headers (e.g. curl), does the request succeed?

@jromerob
Copy link
Author

jromerob commented Nov 8, 2017 via email

@jromerob
Copy link
Author

jromerob commented Nov 9, 2017

More info:

`curl -v "127.0.0.1:8123/http://www.cartociudad.es/services/api/route?orig=43.1514858477619,-4.0472363927932&dest=40.44184877149766,-3.5748567877248845&locale=es&vehicle=WALK"
STATE: INIT => CONNECT handle 0x20081ad8; line 1407 (connection #-5000)
Added connection 0. The cache now contains 1 members
Trying 127.0.0.1...
TCP_NODELAY set
STATE: CONNECT => WAITCONNECT handle 0x20081ad8; line 1460 (connection #0)
Connected to 127.0.0.1 (127.0.0.1) port 8123 (#0)
STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x20081ad8; line 1567 (connection #0)
Marked for [keep alive]: HTTP default
STATE: SENDPROTOCONNECT => DO handle 0x20081ad8; line 1585 (connection #0)
GET /http://www.cartociudad.es/services/api/route?orig=43.1514858477619,-4.0472363927932&dest=40.44184877149766,-3.5748567877248845&locale=es&vehicle=WALK HTTP/1.1
Host: 127.0.0.1:8123
User-Agent: curl/7.51.0
Accept: /

STATE: DO => DO_DONE handle 0x20081ad8; line 1664 (connection #0)
STATE: DO_DONE => WAITPERFORM handle 0x20081ad8; line 1791 (connection #0)
STATE: WAITPERFORM => PERFORM handle 0x20081ad8; line 1801 (connection #0)
HTTP 1.1 or later with persistent connection, pipelining supported
HTTP/1.1 200 OK
x-request-url: http://www.cartociudad.es/services/api/route?orig=43.1514858477619,-4.0472363927932&dest=40.44184877149766,-3.5748567877248845&locale=es&vehicle=WALK
Server Apache-Coyote/1.1 is not blacklisted
server: Apache-Coyote/1.1
content-type: application/json
transfer-encoding: chunked
date: Thu, 09 Nov 2017 09:35:47 GMT
Marked for [closure]: Connection: close used
connection: close
x-final-url: http://www.cartociudad.es/services/api/route?orig=43.1514858477619,-4.0472363927932&dest=40.44184877149766,-3.5748567877248845&locale=es&vehicle=WALK
access-control-allow-origin: *
access-control-expose-headers: server,content-type,transfer-encoding,date,connection,x-final-url,access-control-allow-origin

bbox":["-4.153689089872445","40.44187308607131","-3.5741682031937287","43.152457508872246"],"distance":"353022.13238046836","found":"true","from":"43.1514858477619,-4.0472363927932","geom":"yekfGpcuWRm@f@qATo@Ja@n@gAPaACcBn@MfCu@VKRUb@_
e@tC_@@Gf@KFAA]ZA~DGZCTKpDsBzA}@K_GbDiBl@YVIv@S\OLGLWVQHINERCT@bALATl@AvCV@C|@ida@hAT@TX@rh@Ll@DjAHj@LJl@h@NPJEPMVSBPLhALAH^JZVz@LZLZr@hA|@bAp@l@r@h@~@f@|B|@zDv@dARj@Hd@BF@~@XAb@fB~@d@\x@r@dApALT\p@JVPVJVLTL^JVNZLTLVZn@PT^j@P
TNVp@ANRNVZd@T\\j@fAJVLXf@lANVZp@HXj@fAHPBDd@f@b@b@f@\\RNTJRJz@f@C~@Par@x@l@hAfARPPTNT@f@NZPTJT@f@lAtBp@rANVJNPRJLNFJHEBVLVDTD\DVHTDj@T~@xn@?xAOf@Wh@]dAoA@e@ROPSd@a@LSlA}@bAWj@AbAN~@^@JV?ASAYROPSTq@B[A_@?@A]?@@_@J{@tu@L[Zm@
g@ROTIbAQj@?l@Bj@Lj@PRLTHfBnA|@d@TBV?AWj@IV?TDTHb@@t@x@RNj@Vh@VRPB@NLPRB@r@p@h@VTHvAb@f@ZPR^j@NVJXTt@LZJV@j@PFzA^RHTNj@NTHj@VRFj@TAZRLTJRNRHRJvAj@RLTJpAp@RRb@d@LVJZXn@NV\p@NRPT^l@n@ANVNV^j@n@fAJVHZD\\@^H\\JVNTRNTLTJ|@f@THRFn@@bAKl TIRKTMz@g@~@e@tCqATI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@nDbBhCvAlAl@D@XNtAb@zBl@z@NrCb@pCNpCDPArDIrBa@~@[fBy@JEtCuBJGd@_@D?x@e@@qt@UnA]x@QXCZCAAbABz@H~@N~@PhBj@X @Nx@Zr@^bCtAXP~@t@vAlAVTZZBrAvBbBhErDz@p@dBxA|DdDl@f@ZVfGbFfAAvBlBbCfBv@p@dAbATRb@j@\\h@RXVb@DH|AdC@|@x@BJVPZL\\x@nBJ\\Rh@d@vAN^Pj@@vapt@J@XnAR~@FVNn@v@jDVbADP@HH^b@hBV~@JXb@tAl@|A^t@JXr@pAt@hAXh@bAxAHH\\d@jAdBh@~@b@r@Xf@T@vf@|@f
ApB^
@zv@JXJ^HP\hAN@HT@@FP~AlFn@fB@haj^Vx@f@lA^x@b@l@JL^@PJRPf@ZLDFB@npbv@HR@V?\BrA?XCj@ATARAP?h@EZCv@Gn@I^ElAQPEf@KASVCzAa@bGcC~BmAbCsAxBuAjBeBtAcBvBaCpByBjAoANQfCwCtBkBpBeBtBuB|BmAlCa@z@FZHTHlA\\bCpApCx@bAFDEl@CRARCZEf@KZK|@]j`

@jromerob
Copy link
Author

jromerob commented Nov 9, 2017

Hi i think i found the problem:

I'm loading the app on localhost and the proxy on 127.0.0.1, in this case fails the request
image

if load the app over 127.0.0.1 the request works !!
image

@jromerob
Copy link
Author

jromerob commented Nov 9, 2017

More info: Changing my configuration to use localhost in request and proxy.js to run CORS Anywhere on localhost (not 127.0.0.1 ) didn´t work:
image

@Rob--W
Copy link
Owner

Rob--W commented Nov 11, 2017

Is localhost resolving to 127.0.0.1 ?

@jromerob
Copy link
Author

jromerob commented Nov 11, 2017 via email

@Rob--W
Copy link
Owner

Rob--W commented Nov 11, 2017

Curl works right:

Can you use exactly the same curl command as the browser (in the devtools you can right-click on a request row and click to copy as a curl command). Then repeatedly issue the request and remove headers at each step until you found which request header results in a difference of how a request is handled.

@Rob--W Rob--W closed this as completed Apr 14, 2018
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