servicenow api call from a proxy

vsv0001
Mega Contributor

we are trying to make a call to service now api inside a nestjs application using axios. the call is going through a proxy

const url = 'https://xyztest.service-now.com/api/x_mcim_unified/incident_view';

response = this.httpService.get(url,{
        headers: {
          'Content-Type': 'application/json',
          Authorization: 'Bearer xyz'
      },
      params: queryJSON,
      proxy : {
        protocol: 'http',
        host : 'localhost',
        port: 3128
       },
       withCredentials : true,
       maxRedirects : 30
      }).pipe(map(x => x.data));

 we are seeing this error

[Nest] 49688  - 06/05/2023, 2:24:02 PM   ERROR [ExceptionsHandler] Maximum number of redirects exceeded
Error [ERR_FR_TOO_MANY_REDIRECTS]: Maximum number of redirects exceeded
  

 
I have tried increasing the  maxRedirects : 30. that does not help neither does the 

withCredentials.

Does anyone have suggestions for getting to servicenow through a proxy by avoid redirection errors?

Thanks

0 REPLIES 0