🚨fix: session cookie option 수정
This commit is contained in:
parent
d7bd5d4e93
commit
3a0308df97
1
.gitignore
vendored
1
.gitignore
vendored
@ -41,3 +41,4 @@ next-env.d.ts
|
|||||||
#lock files
|
#lock files
|
||||||
yarn.lock
|
yarn.lock
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
certificates
|
||||||
@ -6,7 +6,8 @@
|
|||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint"
|
"lint": "next lint",
|
||||||
|
"serve": "node server.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nextui-org/react": "^2.4.2",
|
"@nextui-org/react": "^2.4.2",
|
||||||
|
|||||||
40
server.js
Normal file
40
server.js
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
const http = require('http')
|
||||||
|
const { parse } = require('url')
|
||||||
|
const next = require('next')
|
||||||
|
|
||||||
|
const https = require('https')
|
||||||
|
const fs = require('fs')
|
||||||
|
|
||||||
|
const dev = process.env.NODE_ENV !== 'production'
|
||||||
|
const app = next({ dev })
|
||||||
|
const handle = app.getRequestHandler()
|
||||||
|
|
||||||
|
const PORT = 3000
|
||||||
|
|
||||||
|
const httpsOptions = {
|
||||||
|
key: fs.readFileSync('./certificates/key.pem'),
|
||||||
|
cert: fs.readFileSync('./certificates/cert.pem'),
|
||||||
|
}
|
||||||
|
|
||||||
|
app.prepare().then(() => {
|
||||||
|
http
|
||||||
|
.createServer((req, res) => {
|
||||||
|
const parsedUrl = parse(req.url, true)
|
||||||
|
handle(req, res, parsedUrl)
|
||||||
|
})
|
||||||
|
.listen(PORT, (err) => {
|
||||||
|
if (err) throw err
|
||||||
|
console.log(`> Ready on http://localhost:${PORT}`)
|
||||||
|
})
|
||||||
|
|
||||||
|
// https 서버 추가
|
||||||
|
https
|
||||||
|
.createServer(httpsOptions, (req, res) => {
|
||||||
|
const parsedUrl = parse(req.url, true)
|
||||||
|
handle(req, res, parsedUrl)
|
||||||
|
})
|
||||||
|
.listen(PORT + 1, (err) => {
|
||||||
|
if (err) throw err
|
||||||
|
console.log(`> HTTPS: Ready on https://localhost:${PORT + 1}`)
|
||||||
|
})
|
||||||
|
})
|
||||||
@ -3,8 +3,8 @@ export const defaultSession = {}
|
|||||||
export const sessionOptions = {
|
export const sessionOptions = {
|
||||||
password: process.env.SESSION_SECRET,
|
password: process.env.SESSION_SECRET,
|
||||||
cookieName: 'lama-session',
|
cookieName: 'lama-session',
|
||||||
// cookieOptions: {
|
cookieOptions: {
|
||||||
// httpOnly: true,
|
httpOnly: true,
|
||||||
// secure: process.env.NODE_ENV === 'production',
|
secure: process.env.NODE_ENV === 'production',
|
||||||
// },
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user