Closed fylzero closed 3 years ago
The Http Client call returns the following error: cURL error 6: Could not resolve: whatever.test (Domain name not found)
Given the error message is saying that CURL can't resolve the domain name it seems like that's the root issue.
Perhaps fixing that is as simple as setting your Mac's network settings to use 127.0.0.1
as a primary resolver in your DNS providers list?
@drbyte I can get it working by adding 127.0.0.1 myapi.test
into /etc/hosts
but would imagine this should be able to, and would be intended to, work without doing that. Namely as one of the first sentences in the readme of this project is "No Vagrant, no /etc/hosts file." 😃
I've also seen other solutions where people are re-installing or updating curl-openssl: https://stackoverflow.com/questions/54688451/curl-laravel-valet-dnsmasq-not-working
Could this be a dependency issue with Valet?
I've also seen other solutions where people are re-installing or updating curl-openssl:
It could be that your own CURL/openssl components are not working correctly.
(And it's worth updating them (updating all your homebrew stuff regularly)).
But the reason I mention adding localhost to your DNS resolvers is that Valet relies on dnsmasq to do the resolving of .test
domains, and if your CURL install is defaulting to some other lookup source first then it won't get what dnsmasq is expected to provide for you.
My point, which you've confirmed by mentioning that the hosts
file edits work, is that your CURL isn't using dnsmasq for its name resolution.
The simplest way to fix that is to tell your Mac to use 127.0.0.1
as the first (or only) DNS provider.
System Preferences -> Network -> Advanced -> DNS
I wound up following the advice in the StackOverflow link...
brew uninstall curl-openssl --ignore-dependencies
brew services restart php
valet restart
I guess that makes this a cURL version issue.
Clear description of your problem
When serving a front end and backend codebase in Valet, if you try to use the Laravel Http Client to simply make a call from the front end to the backend using the Valet test URL it errors out.
Expected behavior
The call should be successful.
Current behavior
The Http Client call returns the following error: cURL error 6: Could not resolve: whatever.test (Domain name not found) (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
Steps to Reproduce
Output of these steps
See current behavior section for the returned error.
Possible solution
Still looking.
Diagnosis
sw_vers
valet --version
cat ~/.config/valet/config.json
cat ~/.composer/composer.json
composer global diagnose
composer global outdated
ls -al /etc/sudoers.d/
brew config
brew services list
brew list --versions | grep -E "(php|nginx|dnsmasq|mariadb|mysql|mailhog|openssl)(@\d\..*)?\s"
brew outdated
php -v
which -a php
php --ini
nginx -v
curl --version
php --ri curl
~/.composer/vendor/laravel/valet/bin/ngrok version
ls -al ~/.ngrok2
brew info nginx
brew info php
brew info openssl
openssl version -a
openssl ciphers
sudo nginx -t
which -a php-fpm
/usr/local/opt/php/sbin/php-fpm -v
sudo /usr/local/opt/php/sbin/php-fpm -y /usr/local/etc/php/7.4/php-fpm.conf --test
ls -al ~/Library/LaunchAgents | grep homebrew
ls -al /Library/LaunchAgents | grep homebrew
ls -al /Library/LaunchDaemons | grep homebrew