We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2934482 commit fb41eafCopy full SHA for fb41eaf
src/service/CoaContext.ts
@@ -54,6 +54,13 @@ export class CoaContext {
54
return host.toString().split(',', 1)[0].trim() || ''
55
}
56
57
+ // 获取真实ip地址
58
+ get realIp () {
59
+ const headers = this.req.headers
60
+ const ips = headers['ali-cdn-real-ip'] || headers['x-original-forwarded-for'] || headers['x-real-ip'] || headers['x-forwarded-for'] || ''
61
+ return ips.toString().split(',', 1)[0].trim()
62
+ }
63
+
64
// 根据session名称,获取session信息,支持各种类型的参数,包括 query body headers
65
session (name: string) {
66
name = name.toLowerCase()
0 commit comments