Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

eddy1992's avatar

cURL Domain name not found Valet

Hi, I am trying to do a Get Guzzle request on a route that is on the same project and I am getting an error. I am using Laravel Valet.

My code

Route::get('pdf', function(){
	$pdf = App::make('dompdf.wrapper');
	$pdf->loadHTML('<h1>Test</h1>');
	return $pdf->stream();
});

Route::get('order', function(){
	$client = new \GuzzleHttp\Client();
	$base = 'http://ebdaa-dev-master.test';
	$response = $client->request('GET', $base.'/pdf');
	echo "<pre>";
	print_r($response->getBody());
});

My error

GuzzleHttp\Exception\ConnectException
cURL error 6: Could not resolve: ebdaa-dev-master.test (Domain name not found) (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)

I am calling the same pdf route which is the get request. I am on Valet. Please assist in how could I solve this?

Thank you.

0 likes
9 replies
Maximilien's avatar

Hi @eddy1992

What's the result of the following terminal command please ? dig ebdaa-dev-master.test

eddy1992's avatar

Hi @maximilien. Thank you for your response. This is the output below-:

; <<>> DiG 9.10.6 <<>> ebdaa-dev-master.test
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 60928
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 8192
;; QUESTION SECTION:
;ebdaa-dev-master.test.		IN	A

;; AUTHORITY SECTION:
.			53919	IN	SOA	a.root-servers.net. nstld.verisign-grs.com. 2020041600 1800 900 604800 86400

;; Query time: 95 msec
;; SERVER: 4.2.2.2#53(4.2.2.2)
;; WHEN: Thu Apr 16 20:15:48 IST 2020
;; MSG SIZE  rcvd: 125

Maximilien's avatar

OK, seeems to be a problem with dnsmask as its a public server answering.

You should enable logging in dnsmasq in ~/.config/valet/dnsmasq.conf where your tld should be configured (.test)

You can add the following linesn changing YOUR-USER

# 20200416 - Adding logging
log-facility=/Users/YOUR-USER/Downloads/dnsmasq.log
log-queries

Then sudo brew services stop dnsmasq && sudo brew services start dnsmasq && brew services list

The take a look at ~/Downloads/dnsmasq.lo and check for anything suspicious

! To keep in mind

  • Once solved, remove the logging addition to limit disk space usage
eddy1992's avatar

Hi @maximilien . Thank you for your reply.

This is what the log show -:

Apr 16 22:32:10 dnsmasq[66029]: started, version 2.80 cachesize 150
Apr 16 22:32:10 dnsmasq[66029]: compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack no-ipset auth no-DNSSEC loop-detect no-inotify dumpfile
Apr 16 22:32:10 dnsmasq[66029]: setting --bind-interfaces option because of OS limitations
Apr 16 22:32:10 dnsmasq[66029]: reading /etc/resolv.conf
Apr 16 22:32:10 dnsmasq[66029]: using nameserver 4.2.2.2#53
Apr 16 22:32:10 dnsmasq[66029]: using nameserver 59.144.127.17#53
Apr 16 22:32:10 dnsmasq[66029]: using nameserver 8.8.8.8#53
Apr 16 22:32:10 dnsmasq[66029]: read /etc/hosts - 5 addresses

Maximilien's avatar

Hi,

Can you share sudo brew services stop dnsmasq && sudo brew services start dnsmasq && brew services list output please ?

Regards,

AlexFD's avatar

Hi !

I had same issue and follow the steps you mentioned !

On my local machine restarting dnsmasq output is

Stopping `dnsmasq`... (might take a while)
==> Successfully stopped `dnsmasq` (label: homebrew.mxcl.dnsmasq)
Warning: Taking root:admin ownership of some dnsmasq paths:
  /usr/local/Cellar/dnsmasq/2.79/sbin
  /usr/local/Cellar/dnsmasq/2.79/sbin/dnsmasq
  /usr/local/opt/dnsmasq
  /usr/local/var/homebrew/linked/dnsmasq
This will require manual removal of these paths using `sudo rm` on
brew upgrade/reinstall/uninstall.
==> Successfully started `dnsmasq` (label: homebrew.mxcl.dnsmasq)
Name      Status  User     Plist
dnsmasq   started root     /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
mariadb   started fabrique /Users/fabrique/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
[email protected] started fabrique /Users/fabrique/Library/LaunchAgents/[email protected]
nginx     started root     /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
php       started root     /Library/LaunchDaemons/homebrew.mxcl.php.plist
redis     stopped

and log is showing

May 20 15:33:16 dnsmasq[6813]: started, version 2.79 cachesize 150
May 20 15:33:16 dnsmasq[6813]: compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack no-ipset auth no-DNSSEC loop-detect no-inotify
May 20 15:33:16 dnsmasq[6813]: setting --bind-interfaces option because of OS limitations
May 20 15:33:16 dnsmasq[6813]: reading /etc/resolv.conf
May 20 15:33:16 dnsmasq[6813]: using nameserver 89.2.0.1#53
May 20 15:33:16 dnsmasq[6813]: using nameserver 89.2.0.2#53
May 20 15:33:16 dnsmasq[6813]: read /etc/hosts - 3 addresses

Thanks for your help ! Best

AlunR's avatar

Did anyone manage to resolve this? I've got a pretty vanilla Macbook on Catalina running valet.

If my laravel ( portal.test) project tries to call myapi.test using ZTTP I get cURL error 6: Could not resolve: myapi.test (Domain name not found) (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)

myapi.test works fine in Chrome.

IF I change my DNS to 127.0.0.1 then I lose my internet connectivity unless I hardcode a local DNS server

fylzero's avatar

Having this same problem. I was able to solve by adding my api test address to /etc/hosts

127.0.0.1		myapicode.test

Feels really ugly to have to do this though. Also, if you use Valet secure, that won't work either. I'm trying with the Laravel Http client (Guzzle wrapper) and it complains if I have SSL turned on in Valet. Kinda wish these played nice together. I'm still digging to see if there's a better answer.

I decided to open an issue with the Valet team if anyone wants to follow...

https://github.com/laravel/valet/issues/983

24 likes
amora2972's avatar

@eddy1992 maybe you can try adding ur localhost 127.0.0.1 to your dns in system preferences network advanced dns add a new record, if after that you are not able to reach the internet, then you need to change the order of dns I think

Please or to participate in this conversation.