diff --git a/backend/src/cert/kurama.cert b/backend/src/cert/kurama.cert new file mode 100644 index 0000000..cdab5d4 --- /dev/null +++ b/backend/src/cert/kurama.cert @@ -0,0 +1,59 @@ +-----BEGIN CERTIFICATE----- +MIIE/DCCA+SgAwIBAgISAxUCowQKpVSiSz5FacanaHi1MA0GCSqGSIb3DQEBCwUA +MDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQD +EwJSMzAeFw0yNDAyMTQxMTQ5MjZaFw0yNDA1MTQxMTQ5MjVaMBoxGDAWBgNVBAMT +D2t1cmFtYS1jaGF0Lnh5ejCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB +AMrws5y2RrmtFJl4lYbnr6kZMguK8bYlG/M3sVTqflyEDAupVBg3nMF/AtPh1x4D +n5FiFztfBIRV8ES6qc7ulmmRBPW0Mtj0zvnMTm6Yt+m3JDJSzbSPKJbWdiLmSYSa +/B+ev96WFdDBsGYwuMEi8O9s79/gOmlorgslJA5cGMud6R6Ne/qJ7YTlQWUEOHGS +nPdUrP3IzMGKQ14RyOI0v3tj8Kn7gi8LsFrL9hlpXDBjZwIs04HTRL6ULcpPvFGO +BLzTvsQJ7VWdqSMt/nbPOqf4+Qaj9Zk/TwfnGGMgMx5bzNH+GhnInG6w7qASsm0W +scWAm/2rxEOxFxDhnw+F3sMCAwEAAaOCAiIwggIeMA4GA1UdDwEB/wQEAwIFoDAd +BgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADAdBgNV +HQ4EFgQUtq+mDZ24tr14unS/3aHU1Tn6kbQwHwYDVR0jBBgwFoAUFC6zF7dYVsuu +UAlA5h+vnYsUwsYwVQYIKwYBBQUHAQEESTBHMCEGCCsGAQUFBzABhhVodHRwOi8v +cjMuby5sZW5jci5vcmcwIgYIKwYBBQUHMAKGFmh0dHA6Ly9yMy5pLmxlbmNyLm9y +Zy8wLQYDVR0RBCYw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94sQ4egdRCnbWSDtY7kh+BIm +lJNXoB1lBMEKIq4QDUOXoRgffuDghje1WrG9ML+Hbisq/yFOGwXD9RiX8F6sw6W4 +avAuvDszue5L3sz85K+EC4Y/wFVDNvZo4TYXao6Z0f+lQKc0t8DQYzk1OXVu8rp2 +yJMC6alLbBfODALZvYH7n7do1AZls4I9d1P4jnkDrQoxB3UqQ9hVl3LEKQ73xF1O +yK5GhDDX8oVfGKF5u+decIsH4YaTw7mP3GFxJSqv3+0lUFJoi5Lc5da149p90Ids +hCExroL1+7mryIkXPeFM5TgO9r0rvZaBFOvV2z0gp35Z0+L4WPlbuEjN/lxPFin+ +HlUjr8gRsI3qfJOQFy/9rKIJR0Y/8Omwt/8oTWgy1mdeHmmjk7j1nYsvC9JSQ6Zv +MldlTTKB3zhThV1+XWYp6rjd5JW1zbVWEkLNxE7GJThEUG3szgBVGP7pSWTUTsqX +nLRbwHOoq7hHwg== +-----END CERTIFICATE----- diff --git a/backend/src/cert/kurama.key b/backend/src/cert/kurama.key new file mode 100644 index 0000000..19f2f6c --- /dev/null +++ b/backend/src/cert/kurama.key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEAyvCznLZGua0UmXiVhuevqRkyC4rxtiUb8zexVOp+XIQMC6lU +GDecwX8C0+HXHgOfkWIXO18EhFXwRLqpzu6WaZEE9bQy2PTO+cxObpi36bckMlLN +tI8oltZ2IuZJhJr8H56/3pYV0MGwZjC4wSLw72zv3+A6aWiuCyUkDlwYy53pHo17 ++onthOVBZQQ4cZKc91Ss/cjMwYpDXhHI4jS/e2PwqfuCLwuwWsv2GWlcMGNnAizT +gdNEvpQtyk+8UY4EvNO+xAntVZ2pIy3+ds86p/j5BqP1mT9PB+cYYyAzHlvM0f4a +GcicbrDuoBKybRaxxYCb/avEQ7EXEOGfD4XewwIDAQABAoIBAADOddoMP2SYLGE6 +bB2zWnPNIyo4lAY38xcnBCyBU9ZWuqrb3PcGVuLqadshQqG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XRE5+N9vSarhfoNM55JO/GV7ogjxOcBdlRjFzTADzPSquYz40jekHttZsv1Foxjh +zQMcjx8jTQxDHyzVmXdUcACGDwzI62ZVwlsl0MWb4raU5lVECt1NrA== +-----END RSA PRIVATE KEY----- diff --git a/backend/src/routes/socket.ts b/backend/src/routes/socket.ts index c6db0a0..627c53c 100644 --- a/backend/src/routes/socket.ts +++ b/backend/src/routes/socket.ts @@ -15,11 +15,11 @@ app.use(cors()); dotenv.config(); const options = { - key: fs.readFileSync("/acme/live/kurama-chat.xyz/privkey.pem"), - cert: fs.readFileSync("/acme/live/kurama-chat.xyz/fullchain.pem"), + key: fs.readFileSync("../cert/kurama.key"), + cert: fs.readFileSync("../cert/kurama.cert"), }; -export const server = https.createServer(app); +export const server = https.createServer(options, app); const io = new Server(server, { cors: { diff --git a/frontend/src/contexts/SocketContext.tsx b/frontend/src/contexts/SocketContext.tsx index bb9d530..20b9be6 100644 --- a/frontend/src/contexts/SocketContext.tsx +++ b/frontend/src/contexts/SocketContext.tsx @@ -43,7 +43,9 @@ export default function SocketProvider({ return; } if (!socket) { - let socket = socketIO.connect(process.env.NEXT_PUBLIC_BASE_URL!); + let socket = socketIO.connect(process.env.NEXT_PUBLIC_BASE_URL!, { + rejectUnauthorized: false, // Ajoutez cette ligne si vous utilisez un certificat SSL auto-signé + }); socket.on("receive_message", (data: IMessage) => { setMessages((prev) => { const newMessages = { ...prev }; diff --git a/playbook.yml b/playbook.yml index d780e0b..0fe17f3 100644 --- a/playbook.yml +++ b/playbook.yml @@ -123,7 +123,7 @@ MONGODB_USER={{ MONGODB_USER }} MONGODB_USER_PASSWORD={{ MONGODB_USER_PASSWORD }} SITE_ADDRESS={{ SITE_ADDRESS }} - NEXT_PUBLIC_BASE_URL=http://{{ SITE_ADDRESS }}:{{ PORT }}/ + NEXT_PUBLIC_BASE_URL={{ NEXT_PUBLIC_BASE_URL }} PORT={{ PORT }} DEBUG={{ DEBUG }} ORIGIN_URL={{ ORIGIN_URL }}