Skip to content

Commit 972c7a6

Browse files
committed
fixed date issue.
1 parent 286ed34 commit 972c7a6

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Proxy.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -429,10 +429,13 @@ let Proxy = ({ProxyMiddleware, blockedSites, urlModify, httpprefix, serverName,
429429
const setCookieHeaders = proxyRes.headers['set-cookie'] || []
430430
console.log(`1`)
431431
let datestr = ''
432+
let datestrOriginHost = ''
432433
if (setCookieHeaders.length > 0) {
433-
let date = new Date
434-
date.setDate(date.getDate() + 1) // 一天之后过期
434+
let curDate = new Date()
435+
let date = new Date(curDate.getTime() + 7200 * 1000) // 2 hours later
435436
datestr = date.toUTCString()
437+
date = new Date(curDate.getTime() + 600 * 1000) // 10 mins later
438+
datestrOriginHost = date.toUTCString()
436439
}
437440
console.log(`2, setCookieHeaders:${JSON.stringify(setCookieHeaders)}`)
438441
const modifiedSetCookieHeaders = setCookieHeaders
@@ -453,7 +456,7 @@ let Proxy = ({ProxyMiddleware, blockedSites, urlModify, httpprefix, serverName,
453456
cookie_originalHost.name = 'ORIGINALHOST'
454457
cookie_originalHost.value = `${httpType}/${host}`
455458
cookie_originalHost.domain = `${serverName}`
456-
cookie_originalHost.expiration_date = datestr
459+
cookie_originalHost.expiration_date = datestrOriginHost
457460
cookie_originalHost.path = `/`
458461
cookie_originalHost.secure = false
459462
modifiedSetCookieHeaders.push(cookie_originalHost.toString())

0 commit comments

Comments
 (0)