Aithan
02/23/2026, 3:16 AMN/https from forwarding the original Authorization header during a 302 redirect?
The Problem: > I’m calling a third-party endpoint that redirects to a signed S3 URL. The destination (S3) returns a 400 'InvalidArgument' because NetSuite persists the original Bearer token to the redirected domain, and S3 doesn't allow two auth mechanisms (the header + the query params).
The Weird Part: > This works perfectly in standard fetch or Postman (as they strip headers cross-domain on redirects), but I need this to run natively in a Suitelet. the external api suggested me to use the "Double-Fetch" workaround (letting it fail to capture the redirected URL), but when S3 returns that 400 error, response.url comes back empty/undefined or it doesn't show any url from the response at all, leaving me with no URL to re-call.
const getDocument = (accessToken, recordId) => {
// This call triggers a 302 redirect to a signed storage URL
const response = https.get({
url: `<https://api.externalvendor.com/v1/files/${recordId}>`,
headers: {
'Authorization': 'Bearer ' + accessToken,
'Accept': 'application/pdf'
}
});