title: Symfony - Guzzle request: cURL error 6: Could not resolve host
body: <p>I have a symfony application with two controllers. One of the controllers randomly return an element of an array, like this:</p>
  
  <pre><code>$responses = array("foo", "bar", "baz");
  
  return new JsonResponse($responses[array_rand($responses)]);
  </code></pre>
  
  <p>The other one has a form and if that form is valid and is submitted it should create a new guzzle client and display one of the array elements from the other controller:</p>
  
  <pre><code>...
  if ($form-&gt;isSubmitted() &amp;&amp; $form-&gt;isValid()) {
      $client = new Client([
          'base_uri' =&gt; 'foo.local',
      ]);
      $response = $client-&gt;request('GET', '/bar');
  </code></pre>
  
  <p>This results in  a <strong>cURL error 6: Could not resolve host.</strong></p>
  
  <p>I do have nginx up and running and can access both controllers separately via their routes.</p>
  
  <p>I could not find any solutions, hope someone can help me out with some ideas on this.</p>