跳转到内容

Astro.clientAddress is not available in static mode.

StaticClientAddressNotAvailable: Astro.clientAddress 仅在设置为 output: 'server'output: 'hybrid' 时可用. 如果需要使用 SSR 的功能,请更新 Astro 配置。

只有在启用服务端渲染时,Astro.clientAddress 属性才可用。

如要在静态模式下获取用户的 IP 地址,可以在客户端脚本 中使用类似于 Ipify 等不同的 API,或者可以使用托管在服务提供商处的无服务器 (serverless) 函数来获取用户的 IP。

请参阅: