tiredofit / docker-osticket

Dockerized help desk application
MIT License
71 stars 56 forks source link

Only proxy IP is visible in logs #40

Closed radokristof closed 1 year ago

radokristof commented 1 year ago

I'm using caddy as a reverse proxy, also CloudFlare DDos protection is used (so generally another proxy).

In docker-compose right now for testing purposes I have this:

   - NGINX_SET_REAL_IP_FROM=0.0.0.0/0

Caddy config is simple:

support.example.com {
        reverse_proxy localhost:8181
}

Thought even this way, I can only see Cloudflare IPs in the logs. Docker gets IP from 192.168.0.0/16 range, so this is also unique. If I remove the NGINX_SET_REAL_IP env, I can only see the docker IP address, with this setting Cloudflare proxy IP, but I never seen the real IP in the logs.

What am I missing, what should be configured?

radokristof commented 1 year ago

In nginx logs I can see the correct IP in log lines, like this:

2023-07-18T08:50:42+02:00 <ACTUAL-IP-REDACTED>, 172.68.51.80 (Cloudflare proxy IP)

Same for php-fpm log, just appended a localhost proxy to the list:

2023-07-18T08:50:42+0200 <ACTUAL-IP-REDACTED>, 172.68.51.80 127.0.0.1

However on Admin Panel -> Dashboard -> System logs, the IP is incorrect. What can be changed to have this work correctly?

radokristof commented 1 year ago

It was an osticket config error. Need to specify 'TRUSTED_PROXIES' also in 'ost-config.php' file and add cloudflare networks there