umami icon indicating copy to clipboard operation
umami copied to clipboard

IGNORE_IP in env variables not working

Open wokalek opened this issue 8 months ago • 1 comments

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

wokalek avatar Apr 11 '25 21:04 wokalek

This issue is stale because it has been open for 60 days with no activity.

github-actions[bot] avatar Jun 11 '25 02:06 github-actions[bot]

This issue was closed because it has been inactive for 7 days since being marked as stale.

github-actions[bot] avatar Jun 19 '25 02:06 github-actions[bot]

It is really disheartening to see this just be ignored. I'm having the same issue on version 2.18.1

jlar0che avatar Jun 25 '25 05:06 jlar0che

@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;
}

mikecao avatar Jun 25 '25 18:06 mikecao

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``

jlar0che avatar Jul 10 '25 09:07 jlar0che

Hello?

jlar0che avatar Jul 24 '25 14:07 jlar0che