<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Bart Walczak</title>
    <description>The latest articles on DEV Community by Bart Walczak (@bartwalczak).</description>
    <link>https://dev.to/bartwalczak</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1003864%2Ff61722cd-28f6-42bb-a9b7-2773e79d25e3.jpeg</url>
      <title>DEV Community: Bart Walczak</title>
      <link>https://dev.to/bartwalczak</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bartwalczak"/>
    <language>en</language>
    <item>
      <title>React app in Docker fetch can't find a server</title>
      <dc:creator>Bart Walczak</dc:creator>
      <pubDate>Sun, 08 Jan 2023 09:18:31 +0000</pubDate>
      <link>https://dev.to/bartwalczak/react-app-in-docker-fetch-cant-find-a-server-1j26</link>
      <guid>https://dev.to/bartwalczak/react-app-in-docker-fetch-cant-find-a-server-1j26</guid>
      <description>&lt;p&gt;I've got a React app build with Create-React-App running inside a docker container.&lt;/p&gt;

&lt;p&gt;This code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    const req = new Request(
        apiAdminUrl + '/login', {
        method: 'POST',
        body: formData
    }
    return fetch(req).then(processResp, processErr);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Returns &lt;code&gt;TypeError: Load failed&lt;/code&gt;, "Failed to load resource: A server with the specified hostname could not be found."&lt;/p&gt;

&lt;p&gt;But the curl request from the same container works without issues:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -d "email=admin@some.etc" -d "pwd=xxx" -X POST http://api-admin:3000/v1/login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;CORS is enabled in the api code. &lt;code&gt;apiAdminUrl&lt;/code&gt; is properly set as &lt;code&gt;http://api-admin:3000/v1&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;What am I missing? &lt;/p&gt;

</description>
      <category>ai</category>
      <category>discuss</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
