Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Enable x-real-ip

Blue Mousecb61b97838fa
diff --git a/backend/apps/cloud/src/common/utils.ts b/backend/apps/cloud/src/common/utils.ts
index 3ca386bb3..f11f82bd8 100644
--- a/backend/apps/cloud/src/common/utils.ts
+++ b/backend/apps/cloud/src/common/utils.ts
@@ -261,14 +261,13 @@ export const getIPFromHeaders = (
}
// Get IP based on the NGINX configuration
- // No need to do this if API is behind a load balancer
- // let ip = headers['x-real-ip']
+ let ip = headers['x-real-ip']
- // if (ip) {
- // return ip
- // }
+ if (ip) {
+ return ip
+ }
- const ip = headers['x-forwarded-for'] || null
+ ip = headers['x-forwarded-for'] || null
if (!ip) {
return null