Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
learn-online-pc
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
learn-online-pc
Commits
8a0b9699
提交
8a0b9699
authored
3月 29, 2019
作者:
GOD_ZYX
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sesssion 设置
上级
c1e3d913
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
15 行增加
和
20 行删除
+15
-20
ProxyMonitor.js
server/controller/ProxyMonitor.js
+0
-6
distRun.js
server/distRun.js
+15
-14
没有找到文件。
server/controller/ProxyMonitor.js
浏览文件 @
8a0b9699
...
...
@@ -143,12 +143,6 @@ const agentProcessor = () => {
if
(
_stoken
)
{
headers
[
'stoken'
]
=
_stoken
}
if
(
global
.
stoken
)
{
headers
[
'stoken'
]
=
global
.
stoken
let
opts
=
{
path
:
'/'
,
domain
:
'.ezijing.com'
,
expires
:
null
,
httpOnly
:
true
}
res
.
cookie
(
'_stoken'
,
global
.
stoken
,
opts
)
global
.
stoken
=
0
}
/* 重新转发请求 */
axios
(
options
).
then
((
data
)
=>
{
...
...
server/distRun.js
浏览文件 @
8a0b9699
const
express
=
require
(
'express'
)
const
session
=
require
(
'express-session'
)
//
const session = require('express-session')
const
history
=
require
(
'connect-history-api-fallback'
)
const
path
=
require
(
'path'
)
const
app
=
express
()
let
sessionOpts
=
{
// 设置密钥
secret
:
'a cool secret'
,
// Forces the session to be saved back to the session store
resave
:
true
,
// Forces a session that is "uninitialized" to be saved to the store.
saveUninitialized
:
true
,
// 设置会话cookie名, 默认是connect.sid
key
:
'_STOKEN'
,
// If secure is set to true, and you access your site over HTTP, the cookie will not be set.
cookie
:
{
maxAge
:
1000
*
60
*
60
*
2
,
secure
:
false
}
}
//
let sessionOpts = {
//
// 设置密钥
//
secret: 'a cool secret',
//
// Forces the session to be saved back to the session store
//
resave: true,
//
// Forces a session that is "uninitialized" to be saved to the store.
//
saveUninitialized: true,
//
// 设置会话cookie名, 默认是connect.sid
//
key: '_STOKEN',
//
// If secure is set to true, and you access your site over HTTP, the cookie will not be set.
//
cookie: { maxAge: 1000 * 60 * 60 * 2, secure: false }
//
}
app
.
set
(
'port'
,
process
.
env
.
SERVER_PORT
||
3000
)
...
...
@@ -28,7 +28,8 @@ app.get('/', (req, res) => {
/* 增加 限定条件,如果是 e-learning2 子域名,那么 referer 为指定 域名 否则不能打开 */
if
(
/^e-learning2
\.
/
.
test
(
req
.
headers
.
host
))
{
if
(
/
(
sofia
\.
tenant
\.
ezijing
)
|
(
sofia-x
\.
ezijing
)
|
(
course
\.
ezijing
)
|
(
course3
\.
ezijing
)
/
.
test
(
req
.
headers
.
referer
))
{
req
.
session
.
_stoken
=
req
.
query
.
stoken
||
0
let
opts
=
{
path
:
'/'
,
domain
:
'.ezijing.com'
,
expires
:
null
,
httpOnly
:
true
}
res
.
cookie
(
'_stoken'
,
req
.
query
.
stoken
,
opts
)
res
.
sendFile
(
path
.
join
(
__dirname
,
'../client-dist/index.html'
))
}
else
{
res
.
send
(
'当前页面打开方式不对'
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论