HomeLabsSite Metadata

Metadata Card

0 views
Inspired by Seline's founder letter.

Geolocation helper function for @nextjs server components.

import { headers } from "next/headers";
 
export function getGeoLocation() {
  const headersList = await headers();
 
  return {
    ip: headersList.get("x-real-ip") || "Unknown IP",
    country: headersList.get("x-vercel-ip-country") || "Unknown Country",
    city: headersList.get("x-vercel-ip-city") || "Unknown City",
  };
}