fix: 获取真实请求ip(解决使用docker部署时,ssr请求无法获取用户真实ip的问题,解决方案:转发astro headers)
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import Layout from "@/layouts/Layout.astro";
|
||||
import PostList from "@/components/PostList.astro";
|
||||
import type {Post} from "@/types/post";
|
||||
import {http} from "@/lib/request";
|
||||
import {createHttp} from "@/lib/request";
|
||||
import {metadata} from "@/consts.ts";
|
||||
|
||||
const {page} = Astro.params
|
||||
@@ -11,6 +11,8 @@ if (isNaN(Number(page))) {
|
||||
return Astro.redirect('/')
|
||||
}
|
||||
|
||||
const http = createHttp(Astro.request.headers)
|
||||
|
||||
const {list, total} = await http.get<ApiPageResponse<Post>>("post", {
|
||||
searchParams: {
|
||||
page,
|
||||
|
||||
Reference in New Issue
Block a user