From baf20ac94230a93926800d1948c01bd08b608d96 Mon Sep 17 00:00:00 2001 From: jovanHillion Date: Fri, 17 Oct 2025 15:19:42 +0200 Subject: [PATCH] fix(admin login): trying to fix login error Failed to create admin refresh session Cannot send secure cookie over unencrypted connection --- src/index.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 58be268..8f1cf9a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,7 +7,17 @@ export default { * * This gives you an opportunity to extend code. */ - register(/* { strapi }: { strapi: Core.Strapi } */) {}, + // register(/* { strapi }: { strapi: Core.Strapi } */) {}, + + register({ strapi }) { + // Force the socket to be treated as encrypted for proxy setups + strapi.server.use(async (ctx, next) => { + if (ctx.req?.socket) { + (ctx.req.socket as any).encrypted = true; + } + await next(); + }); + }, /** * An asynchronous bootstrap function that runs before