diff --git a/packages/server/Dockerfile b/packages/server/Dockerfile index f63481c373..3aae395bc5 100644 --- a/packages/server/Dockerfile +++ b/packages/server/Dockerfile @@ -66,6 +66,7 @@ COPY packages/server/dist/ dist/ COPY packages/server/docker_run.sh . COPY packages/server/builder/ builder/ COPY packages/server/client/ client/ +COPY packages/server/pm2.config.js . ARG BUDIBASE_VERSION ARG GIT_COMMIT_SHA diff --git a/packages/server/src/utilities/workerRequests.ts b/packages/server/src/utilities/workerRequests.ts index ce43c1aa44..acf7515784 100644 --- a/packages/server/src/utilities/workerRequests.ts +++ b/packages/server/src/utilities/workerRequests.ts @@ -13,6 +13,7 @@ import { tenancy, logging, env as coreEnv, + utils, } from "@budibase/backend-core" import { Ctx, User, EmailInvite } from "@budibase/types" @@ -70,6 +71,14 @@ export function createRequest(request: Request): RequestInit { headers[header] = value } } + // be specific about auth headers + const cookie = ctx.headers[constants.Header.COOKIE], + apiKey = ctx.headers[constants.Header.API_KEY] + if (cookie) { + request.headers[constants.Header.COOKIE] = cookie + } else if (apiKey) { + request.headers[constants.Header.API_KEY] = apiKey + } } // apply tenancy if its available diff --git a/packages/shared-core/src/constants/api.ts b/packages/shared-core/src/constants/api.ts index d6633649e6..f63849bf3d 100644 --- a/packages/shared-core/src/constants/api.ts +++ b/packages/shared-core/src/constants/api.ts @@ -16,4 +16,5 @@ export enum Header { CORRELATION_ID = "x-budibase-correlation-id", AUTHORIZATION = "authorization", MIGRATING_APP = "x-budibase-migrating-app", + COOKIE = "cookie", } diff --git a/packages/worker/Dockerfile b/packages/worker/Dockerfile index 52fd3677b1..77869c48f1 100644 --- a/packages/worker/Dockerfile +++ b/packages/worker/Dockerfile @@ -37,6 +37,7 @@ RUN apk del .gyp \ COPY packages/worker/dist/ dist/ COPY packages/worker/docker_run.sh . +COPY packages/server/pm2.config.js . EXPOSE 4001