I'm working on a Symfony project and I've encountered a problem when trying to ping or make a Curl request from the terminal to my Symfony site (Symfony 6 and PHP 8.2). I use Symfony Local Web Server
My Symfony site uses the domain name [SITE_NAME.local] and works correctly when accessed through the browser. However, when I attempt to ping from the terminal using the command ping [SITE_NAME.local], I get the following error: "ping: cannot resolve [SITE_NAME.local]: Unknown host." Additionally, when I try to make a Curl request from the terminal using the command curl [SITE_NAME.local], I also encounter an error.
I've already tried to update the /etc/hosts file, but it resulted in me losing access to the site via the browser (ERR_CONNECTION_REFUSED).
127.0.0.1 SITE_NAME.local
Despite these issues, my Symfony site works fine when accessed through the browser. My goal is to be able to make Curl requests from the terminal to my local project. Do you have any suggestions on what might be causing this problem and how to resolve it? Any help would be greatly appreciated.
Thank you in advance!
You need to set the https_proxy
var for the command to work.
https://symfony.com/doc/current/setup/symfony_server.html#defining-the-local-domain
When running console commands, add the https_proxy env var to make custom domains work:
https_proxy=$(symfony proxy:url) curl https://my-domain.wip