IGNORE_IP in env variables not working
Describe the Bug
I upgraded from 2.13.2 to 2.17.0. Ignoring IP worked before, I didn't change this setting. But now it doesn't work.
I know that you can add a variable to the browser's local storage, but for me it's not a pleasant solution.
Database
PostgreSQL
Which Umami version are you using? (if relevant)
2.17.0
Which browser are you using? (if relevant)
chrome
How are you deploying your application? (if relevant)
Docker: https://github.com/wokalek/wokalek-site/blob/main/docker/services/umami.yml
This issue is stale because it has been open for 60 days with no activity.
This issue was closed because it has been inactive for 7 days since being marked as stale.
It is really disheartening to see this just be ignored. I'm having the same issue on version 2.18.1
@jlar0che how are you defining the IP?
This is the entire function:
export function hasBlockedIp(clientIp: string) {
const ignoreIps = process.env.IGNORE_IP;
if (ignoreIps) {
const ips = [];
if (ignoreIps) {
ips.push(...ignoreIps.split(',').map(n => n.trim()));
}
return ips.find(ip => {
if (ip === clientIp) {
return true;
}
// CIDR notation
if (ip.indexOf('/') > 0) {
const addr = ipaddr.parse(clientIp);
const range = ipaddr.parseCIDR(ip);
if (addr.kind() === range[0].kind() && addr.match(range)) {
return true;
}
}
});
}
return false;
}
Here is how I set things up in my docker-compose.yml: Note 1: I'm only showing the relevant section of my compose (didn't copy/paste the DB portion) Note 2: I've redacted some settings for obvious reasons
services:
umami:
image: ghcr.io/umami-software/umami:postgresql-latest
container_name: REDACTED
ports:
- REDACTED:3000
environment:
DATABASE_URL: postgresql://umami:umami@db:5432/umami
DATABASE_TYPE: postgresql
APP_SECRET: REDACTED
# Specific IP Addresses and also IP Address Ranges can be ignored in the analytics
# -- USAGE: Syntax --
# IGNORE_IP = a comma-delimited list of IP addresses or ranges
# -- USAGE: Example --
# IGNORE_IP = 10.0.1.0/24,192.168.1.200
IGNORE_IP: xxx.yyy.zzz.xyz # REDACTED, but in that format
# IP Identification List:
# -----------------------
# xxx.yyy.zzz.xyz == My Static IP Address
depends_on:
- db
restart: always``
Hello?