2 years ago
Hi I'm getting this error and I have read multiple docs on this and still haven't found a solution
Error: Cannot send secure cookie over unencrypted connection
at Cookies.set (/app/node_modules/@strapi/core/node_modules/cookies/index.js:126:11)
at ContextSession.save (/app/node_modules/koa-session/lib/context.js:341:22)
at ContextSession.commit (/app/node_modules/koa-session/lib/context.js:244:16)
at session (/app/node_modules/koa-session/index.js:46:20)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async middleware (/app/node_modules/@strapi/core/dist/services/metrics/middleware.js:20:5)
Anyone have the same problem on this?
6 Replies
2 years ago
Hello,
Do you have the url and proxy set in your server.js file? -
https://github.com/railwayapp-templates/strapi/blob/main/config/server.js
2 years ago
Hi yes, I've already set up the url and set the proxy to true:
Have I missed something setting up?
module.exports = ({ env }) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
app: {
keys: env.array('APP_KEYS'),
},
url: env('PUBLIC_URL'),
proxy: true,
webhooks: {
populateRelations: env.bool("WEBHOOKS_POPULATE_RELATIONS", false),
},
});2 years ago
That is the recommended solution according to answers on the Strapi forum.
https://forum.strapi.io/t/cannot-send-secure-cookie-over-unencrypted-connection/5317
I think you would want to direct this question to the Strapi community.
2 years ago
Hello
I have found a solution to this problem. If anyone is having any trouble with this and you are using Strapi V5 you'll have to downgrade to V4 to make this work.
Thank you!
Status changed to Solved brody • over 1 year ago
a year ago
Here's a solution for those wanting to use V5:
For V5, replace
proxy: true
with
proxy: {
koa: true
},
Status changed to Open Railway • about 1 year ago
perabjoth
Here's a solution for those wanting to use V5: For V5, replace proxy: true with proxy: { koa: true },
7 months ago
Thaks for the solution, this works for me
