Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!