Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

[ HTTP ] [ STATUS 307 ] Configure Script to Follow Redirect




I am using script to monitor the integrity of an API in my company. The problem is that I am being redirected by the endpoint of the API and cannot configure the script to follow the redirect. For this reason, I receive error code 307 and the request fails. Does anyone know how to enable redirected tracking?

var assert = require('assert');

var options = { 
  url: 'https://<api-url>',
  headers: { 
    'Content-Type': 'application/json; charset=utf-8',
  body: '{"credential": {"effectiveuserid": null,"signature": "<id>","userid": "<user-id>"}}' 

function callback(error, response, body) {
    if (error) throw new Error(error.message);
    assert.ok(response.statusCode == 200, 'Expected 200 OK response and get ' + response.statusCode);  


I solve using the node module request and pass followAllRedirects: true in the request options.


That’s great! Thanks for adding in your solution here :smiley: