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!

reverse x-real-ip change

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