feat(app): 添加多模板关于我们页面及相关路由和404页面
- 新增404页面,优化未找到页面体验,避免被搜索引擎索引 - 增加文件代理接口,隐藏真实文件服务器地址,支持文件请求代理 - 实现/article、/case、/product及/page动态路由兼容列表与详情展示 - 添加动态CMS页面兼容入口处理旧式路径,统一路由与SEO设置 - 新增模板1、模板7、模板2、模板3关于我们页面,实现多模板支持 - 模板增强支持CMS单页内容加载及SEO信息动态设置 - 配置环境变量及Git忽略文件规则辅助开发和构建环境管理
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { getHeader, getRequestIP } from 'h3'
|
||||
|
||||
/**
|
||||
* 还原真实客户端 IP。
|
||||
* 优先级:CF-Connecting-IP > X-Real-IP > X-Forwarded-For(首段) > 连接地址
|
||||
* 适用于多层反代(Cloudflare / Nginx / 负载均衡)场景。
|
||||
*/
|
||||
export function getRealClientIp(event: any): string {
|
||||
const cf = getHeader(event, 'cf-connecting-ip')
|
||||
if (cf) return String(cf).split(',')[0].trim()
|
||||
|
||||
const real = getHeader(event, 'x-real-ip')
|
||||
if (real) return String(real).split(',')[0].trim()
|
||||
|
||||
const xff = getHeader(event, 'x-forwarded-for')
|
||||
if (xff) return String(xff).split(',')[0].trim()
|
||||
|
||||
return getRequestIP(event, { xForwardedFor: false }) || '0.0.0.0'
|
||||
}
|
||||
Reference in New Issue
Block a user