From 9068800b3a948c6c3d7d64b03d6038f1c08ab50c Mon Sep 17 00:00:00 2001 From: BatLeDev Date: Thu, 25 Jun 2026 14:43:34 +0200 Subject: [PATCH] chore(worker): drop x-processing header and always use private data-fair url The x-processing header is no longer consumed: data-fair never read it and the metrics daemon dropped its tracking in favor of x-client. Remove its emission and route all data-fair requests through privateDataFairUrl when set (no more public-url-for-GET-metrics distinction), pruning the now-dead getFromPrivateDataFairUrl config. --- worker/config/custom-environment-variables.mjs | 1 - worker/config/default.mjs | 1 - worker/config/type/schema.json | 3 --- worker/src/task/axios.ts | 13 +++---------- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/worker/config/custom-environment-variables.mjs b/worker/config/custom-environment-variables.mjs index fc0eeb19..ef7e215d 100644 --- a/worker/config/custom-environment-variables.mjs +++ b/worker/config/custom-environment-variables.mjs @@ -8,7 +8,6 @@ export default { defaultLimits: { processingsSeconds: 'DEFAULT_LIMITS_PROCESSINGS_SECONDS' }, - getFromPrivateDataFairUrl: 'GET_FROM_PRIVATE_DATA_FAIR_URL', mails: { transport: { __name: 'MAILS_TRANSPORT', diff --git a/worker/config/default.mjs b/worker/config/default.mjs index 48b49735..55262b3d 100644 --- a/worker/config/default.mjs +++ b/worker/config/default.mjs @@ -30,7 +30,6 @@ export default { processingsSeconds: -1 }, privateDataFairUrl: null, - getFromPrivateDataFairUrl: false, mails: { // transport is a full configuration object for createTransport of nodemailer // cf https://nodemailer.com/smtp/ diff --git a/worker/config/type/schema.json b/worker/config/type/schema.json index 51335d9e..4dceb839 100644 --- a/worker/config/type/schema.json +++ b/worker/config/type/schema.json @@ -57,9 +57,6 @@ } } }, - "getFromPrivateDataFairUrl": { - "type": "boolean" - }, "mails": { "type": "object", "properties": { diff --git a/worker/src/task/axios.ts b/worker/src/task/axios.ts index 9c4450a9..8213dfb5 100644 --- a/worker/src/task/axios.ts +++ b/worker/src/task/axios.ts @@ -26,7 +26,6 @@ export const getAxiosInstance = (processing: Processing, log: LogFunctions) => { if (account.departmentName) account.departmentName = encodeURIComponent(account.departmentName) privateHeaders['x-account'] = JSON.stringify(account) } - privateHeaders['x-processing'] = JSON.stringify({ _id: processing._id, title: encodeURIComponent(processing.title) }) const axiosInstance = axios.create({ // this is necessary to prevent excessive memory usage during large file uploads, see https://github.com/axios/axios/issues/1045 @@ -45,15 +44,9 @@ export const getAxiosInstance = (processing: Processing, log: LogFunctions) => { const isDataFairUrl = cfg.url.startsWith(config.dataFairUrl) if (isDataFairUrl) Object.assign(cfg.headers, privateHeaders) - // use private data fair url if specified to prevent leaving internal infrastructure - // except from GET requests so that they still appear in metrics - // except if config.getFromPrivateDataFairUrl is set to true, then all requests are sent to the private url - const usePrivate = - config.privateDataFairUrl && - isDataFairUrl && - (config.getFromPrivateDataFairUrl || ['post', 'put', 'delete', 'patch'].includes(cfg.method || '')) - if (usePrivate) { - cfg.url = cfg.url.replace(config.dataFairUrl, config.privateDataFairUrl!) + // always route data-fair requests through the private url to stay within internal infrastructure + if (isDataFairUrl && config.privateDataFairUrl) { + cfg.url = cfg.url.replace(config.dataFairUrl, config.privateDataFairUrl) cfg.headers.host = new URL(config.dataFairUrl).host } return cfg