Files
sori.studio/server/utils/request-ip.js

9 lines
289 B
JavaScript

import { getRequestIP } from 'h3'
/**
* 프록시 헤더를 포함해 요청 IP를 조회한다.
* @param {import('h3').H3Event} event - 요청 이벤트
* @returns {string} 요청 IP
*/
export const getClientIp = (event) => String(getRequestIP(event, { xForwardedFor: true }) || '')