fix(core): Forward authorization header when on same domain (#8507)

This commit is contained in:
Elias Meire
2024-01-31 15:11:29 +01:00
committed by GitHub
parent 033fd344b5
commit f1910a10a6
2 changed files with 70 additions and 0 deletions

View File

@@ -452,6 +452,15 @@ async function parseRequestObject(requestObject: IDataObject) {
axiosConfig.maxRedirects = 0;
}
axiosConfig.beforeRedirect = (redirectedRequest) => {
if (axiosConfig.headers?.Authorization) {
redirectedRequest.headers.Authorization = axiosConfig.headers.Authorization;
}
if (axiosConfig.auth) {
redirectedRequest.auth = `${axiosConfig.auth.username}:${axiosConfig.auth.password}`;
}
};
if (requestObject.rejectUnauthorized === false) {
axiosConfig.httpsAgent = new Agent({
rejectUnauthorized: false,