Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

191
Visualizações
How do I remove the remote URL being added to an Axios POST request?

I have a React Web Application and a NodeJS Server, both deployed to Ubuntu EC2 instances. I've confirmed that API calls can be made between them using a CURL request to the private IP address (they're both in the same subnet).

However when I make the call from the React application, the POST request URL is prefixed with the remote URL which causes the API call to fail.

Chrome Developer Tools

The request URL is meant to be http://10.11.1.147/login

It works fine when running both applications on localhost. The API framework is implemented using Axios and React-Query.

Here is the query function performing the POST request (and I've confirmed that REACT_APP_SERVER_URL is the private IP address)

export const postLogin = async ({ email, password }) => {
  let response;
  const cookies = new Cookies();
  try {
    response = await axios.post(`${process.env.REACT_APP_SERVER_URL}/login`, {
      email: email,
      password: password,
    });
    cookies.set("JWT", response.data.jwt, { path: "/" });
    cookies.set("UserId", response.data.userId, { path: "/" });
  } catch (err) {
    return err.response
  }
};
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda