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

192
Visualizações
Relaying api call gets rejected because relaying server's url is not in api's certs

I'm working on a api relay server that is supposed to log the requests and responses of api calls. Problem is when the server attempts to make an api call the api returns with status code 500 because the api's certs does not contain the relay server's url. I've made use of a https agent with options : {rejectUnauthorized: false} to bypass the authentication process. I saw that the host in the headers contains the server's url and I would like to know if I could modify the host to properly make authenticated api calls through the relay server.

Error when not using https agent:

Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames: Host: us-central1-apirelayserver.cloudfunctions.net. is not in the cert's altnames: DNS:*.company.services

API call:

const httpsAgent = new https.Agent({ rejectUnauthorized: false });
let headersJson = JSON.stringify(requestDocument.headers);
let axiosConfig = {headers: JSON.parse(headersJson),httpsAgent};
const info = await axios.post(requestDocument.apiBaseUrl.toString(),requestDocument.body,axiosConfig).catch(error => {
            console.log(error);
            console.log(error.response.body);
        });
response.status(200).send(info.data);
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