From f4d79e811aa2995bbdaf171b69dd024200d321e2 Mon Sep 17 00:00:00 2001 From: Vosjedev Date: Sun, 2 Nov 2025 19:05:32 +0100 Subject: Add ACIT_BEHIND_PROXY for reverse proxy configs --- README.md | 1 + compose.yml | 1 + src/acit/__init__.py | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1cae78b..7a96fd0 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ MYSQL_HOST=localhost # the hostname/ip of the server. to define a port, use host # Settings # -------- ACIT_HOME_REDIRECT=about:blank # where to redirect to when someone queries the webroot +ACIT_BEHIND_PROXY= # when set, acit displays the 'real ip' when behind a proxy # the following option should be the full path to an executable. # said executable should return a table of trackers and urls. diff --git a/compose.yml b/compose.yml index 95fa6d0..c00c167 100644 --- a/compose.yml +++ b/compose.yml @@ -29,6 +29,7 @@ services: - ACIT_MAIL_DOMAIN=example.com #- ACIT_MAIL_USES_ALIASES=true # uncomment to enable - ACIT_HOME_REDIRECT=about:blank + - ACIT_BEHIND_PROXY=true volumes: - ./acit-list-trackers:/usr/lib/acit-list-trackers diff --git a/src/acit/__init__.py b/src/acit/__init__.py index 63d667e..ac96935 100644 --- a/src/acit/__init__.py +++ b/src/acit/__init__.py @@ -1,4 +1,6 @@ +from os import getenv + import cherrypy from .web import Server @@ -25,7 +27,8 @@ def run(): server=Server(dbpool=db,site=site,imap=imap) cherrypy.quickstart(server,'/',{ 'global':{ - 'server.socket_host':'0.0.0.0' + 'server.socket_host':'0.0.0.0', + 'tools.proxy.on':True if getenv("ACIT_BEHIND_PROXY") else False } }) -- cgit