'Strapi connect endpoint 500 internal server error

I have Strapi installed on Azure VM. trying to connect to the /api/connect/microsoft endpoint to do authorization with active directory. Everything works locally but on the server it keeps giving me a 500 internal server error. Strapi on Azure vm is set up with nginx.

This is what we found in the logs

1|strapi-prod  | [2022-02-18 22:59:00.277] http: GET /api/connect/microsoft (60 ms) 302
1|strapi-prod  |   Error: Cannot send secure cookie over unencrypted connection
1|strapi-prod  |       at Cookies.set (/srv/strapi/strapi/node_modules/cookies/index.js:94:11)
1|strapi-prod  |       at ContextSession.save (/srv/strapi/strapi/node_modules/koa-session/lib/context.js:339:22)
1|strapi-prod  |       at ContextSession.commit (/srv/strapi/strapi/node_modules/koa-session/lib/context.js:239:16)
1|strapi-prod  |       at session (/srv/strapi/strapi/node_modules/koa-session/index.js:46:20)
1|strapi-prod  |       at async /srv/strapi/strapi/node_modules/@strapi/strapi/lib/services/metrics/middleware.js:29:5

Any help is appreciated!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source