You've set up api.dev and workbench.dev directly on your machine and not in the vm. So the vm does not know about those hostnames.
Try to add the following to the vm's hostfile.
127.0.0.1 api.dev
127.0.0.1 workbench.dev
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hey all, I've got two separate laravel apps and I'm trying to use guzzle to communicate between the two of them. For sake of example, I'll refer to the apps as A and B.
Both apps are running on homestead under their own urls:
(A) http://api.dev:8000 and (B) http://workbench.dev:8000
Here's some code from my route in app A:
$client = new \GuzzleHttp\Client;
$response = $client->get('http://workbench.dev:8000/test');
dd($response->getBody());
And my /test route in app B just returns a string:
return 'test endpoint reached, success!';
The error I'm getting is:
cURL error 7: Failed to connect to workbench.dev port 8000: Connection refused
Does anyone have a clue as to what's going on here? I can access the route in app B without a problem if i navigate to it in the browser. Would really appreciate any input / help anyone could give, cheers!
Edit: I needed to make the hostfile entries (from the selected answer) and needed remove port 8000. Since the apps were communicating on only the VM the port wasn't needed.
You've set up api.dev and workbench.dev directly on your machine and not in the vm. So the vm does not know about those hostnames.
Try to add the following to the vm's hostfile.
127.0.0.1 api.dev
127.0.0.1 workbench.dev
Please or to participate in this conversation.