3
1
I have a site set up in a virtual box. I am able to access it just fine from a browser on my machine, but I have trouble accessing it via CURL while SSH'ed in to the box.
When I try, curl hangs before displaying the response and exiting.
This is what I run: curl -vvv site1.dev/
This is the output it gives:
* Hostname was NOT found in DNS cache
* Trying 192.168.10.10...
* Connected to site1.dev (192.168.10.10) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: site1.dev
> Accept: */*
>
< HTTP/1.1 200 OK
* Server nginx/1.9.7 is not blacklisted
< Server: nginx/1.9.7
< Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Cache-Control: no-cache
< Date: Fri, 08 Apr 2016 16:47:30 GMT
<
* Connection #0 to host site1.dev left intact
hi
The request portion is sent off right away, but the response hangs for a number of seconds (looks like 120ish), and then curl exits with that message: * Connection #0 to host site1.dev left intact
That is followed by the appropriate body of the response, "hi".
I'm a little lost -- any pointers would be appreciated.
Edit April 11: I've tried wget and see a similar result (response hangs). I suspect it is a network config issue.
In case it is relevant, here is some of the port config for the virtual box.
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 80 => 8000 (adapter 1)
default: 443 => 44300 (adapter 1)
default: 3306 => 33060 (adapter 1)
default: 5432 => 54320 (adapter 1)
default: 22 => 2222 (adapter 1)
EDIT April 12:
So... I decided to destroy this vagrant box and start fresh...doing this has resolved the problem.
I suspect that I changed/broke something over the course of the past several months. Starting over, with the vanilla box settings, has corrected that problem.
Do You have any active redirect in your
site1.dev
's webserver? – Alex – 2016-04-08T18:52:14.823You can try
curl -L site1.dev
to make curl follow redirects. – Alex – 2016-04-08T18:54:22.003Thanks @Alex, that path resolves without redirects. It eventually does give the expected response...I just don't understand why it hangs before doing so...along with that "Connection #0..." message. – Todd – 2016-04-08T19:00:04.640
Given that the HTTP response shows that the server is sending the response body in chunks (see
Transfer-Encoding: chunked
), I am wondering if the server simply never sends the terminating chunk, andcurl
just "hangs", waiting for it... – Castaglia – 2016-04-11T17:52:30.570