title: Symfony 6 - Connection refused for localhost
body: <p>Im using docker (from symfony docs - <a href="https://github.com/dunglas/symfony-docker" rel="nofollow noreferrer">https://github.com/dunglas/symfony-docker</a>) and in symfony 6 i've reciceved:</p>
  <pre><code>Failed to connect to localhost port 443 after 0 ms: Connection refused for &quot;https://localhost/products&quot;.
  </code></pre>
  <p>This addres in browser returns json with products.</p>
  <p>This is controller:</p>
  <pre><code>  &lt;?php
  
  namespace App\Controller;
  
  use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  use Symfony\Component\HttpFoundation\Response;
  use Symfony\Component\Routing\Annotation\Route;
  use Symfony\Component\HttpClient\HttpClient;
  use Symfony\Component\HttpFoundation\JsonResponse;
  
  class ApiController extends AbstractController
  {   
      #[Route('/apire', name: 'api')]
      public function fetchGitHubInformation()
      {
          $client = HttpClient::create();
          $response = $client-&gt;request('GET', 'https://localhost/products');
          
          $content = $response-&gt;getContent();
          $content = $response-&gt;toArray();
  
  
          return new JsonResponse($content);
      }
  }
  </code></pre>
  <p>and this is netstat from caddy docker container:</p>
  <pre><code>/srv/app # netstat -tulpn | grep LISTEN
  tcp        0      0 127.0.0.11:45991        0.0.0.0:*               LISTEN      -
  tcp        0      0 127.0.0.1:2019          0.0.0.0:*               LISTEN      1/caddy
  tcp        0      0 :::443                  :::*                    LISTEN      1/caddy
  tcp        0      0 :::80                   :::*                    LISTEN      1/caddy
  </code></pre>
  <p>Where is the problem?</p>