<p>I am making an application with docker and orchestrator kubernetes.
In the fronted it is made with create-react-app, the problem comes when I want to use axios I get 2 ip in a request.</p>

<p>the code below is the action of the redux to capture the data</p>

<pre><code>import { LOGIN, LOGIN_EXITO, LOGIN_ERROR } from "../types";

// import clienteAxios from "../../axios";
import axios from "axios";
import Swal from "sweetalert2";

const HOST = window._env_.REACT_APP_HOST_BACKEND;
const PORT = window._env_.REACT_APP_PORT_BACKEND;

export function loginAction(user, password) {
  return async (dispatch) =&gt; {
    dispatch(login());

    try {
      // let datos = await clienteAxios.post("/login", { user, password });
      console.log(`${HOST}:${PORT}/api`);
      let datos = await axios.post(`${HOST}:${PORT}/api`, { user, password });
      console.log(datos);

      dispatch(loginExito(datos.data));

      if (datos.data[0].r_mensaje === "ok") {
        Swal.fire("Acceso...", "Bienvenido", "success");
      } else {
        Swal.fire({
          icon: "error",
          title: "Error...",
          text: datos.data[0].r_mensaje,
        });
      }
    } catch (error) {
      console.log(error);
      dispatch(loginError(true));

      Swal.fire({
        icon: "error",
        title: "Error...",
        text: "Intente de nuevo...",
      });
    }
  };
}
</code></pre>

<p>and when making the query this error throws me, that 2 ip join
<a href="https://i.stack.imgur.com/2Bb3i.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2Bb3i.png" alt="enter image description here"></a></p>

<p>this is my nginx.conf that I use in the dockerfile.</p>

<pre><code>server {

  listen 3000;

  location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm;
    try_files $uri $uri/ /index.html;
  }

  error_page   500 502 503 504  /50x.html;

  location = /50x.html {
    root   /usr/share/nginx/html;
  }

}
</code></pre>

Silvio Peña
<p>Axios is interpreting your argument as a relative path and is automatically appending the scheme, host and port to form the request URL.</p>

<p>For example, <code>axios.post('/user', ...)</code>, would translate to <code>http://172.17.0.3:30599/user</code>.</p>

<p>You can fix this by passing the full URL:</p>

<pre><code>axios.post(`http://${HOST}:${PORT}/api`, ...)
</code></pre>

<p>Alternatively, create an axios instance, set <code>baseURL</code> in the config, and use <code>instance.post('/api')</code>.</p>
