Log the real client IP for requests proxied through pi4 #58

Open
opened 2026-11-10 19:47:06 +00:00 by martin · 0 comments
Owner

Summary

nidaros nginx logs every proxied request with pi4's LAN address (192.168.10.188), so external clients cannot be attributed. This made triaging the 2026-11-09 callback burst much harder than necessary.

Context

  • pi4 already forwards X-Forwarded-For through recommendedProxySettings.
  • nidaros nginx uses the default combined log format, which omits the header.
  • Access logs are file-based (/var/log/nginx/access.log), so journalctl -u nginx shows no request lines.

Scope

  • Add a log format that includes $http_x_forwarded_for and apply it to proxied virtual hosts (the kitchenowl vhost is generated by the flake module, so it needs an accessLog override from this repository).
  • Optionally configure set_real_ip_from for pi4 so $remote_addr is the real client.

Acceptance criteria

  • A request from outside the LAN produces a log line containing the original client IP.
  • LAN-local requests are still logged without errors.
  • The selected vhosts use the new format; unrelated vhosts are unchanged.
## Summary nidaros nginx logs every proxied request with pi4's LAN address (192.168.10.188), so external clients cannot be attributed. This made triaging the 2026-11-09 callback burst much harder than necessary. ## Context - pi4 already forwards `X-Forwarded-For` through `recommendedProxySettings`. - nidaros nginx uses the default `combined` log format, which omits the header. - Access logs are file-based (`/var/log/nginx/access.log`), so `journalctl -u nginx` shows no request lines. ## Scope - Add a log format that includes `$http_x_forwarded_for` and apply it to proxied virtual hosts (the kitchenowl vhost is generated by the flake module, so it needs an `accessLog` override from this repository). - Optionally configure `set_real_ip_from` for pi4 so `$remote_addr` is the real client. ## Acceptance criteria - [ ] A request from outside the LAN produces a log line containing the original client IP. - [ ] LAN-local requests are still logged without errors. - [ ] The selected vhosts use the new format; unrelated vhosts are unchanged.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Personal/nixos-configuration#58
No description provided.