Log request bodies at nginx and view logs in Dozzle
nginx writes one JSON line per request, body included, to logs/nginx/payloads.log (nginx/payload_log.conf). Bodies mentioning a password, token or secret are logged as [redacted]. A `traffic` container tails the file so it shows up as its own stream in Dozzle, which is served at /dozzle/ behind the admin auth_request. Dozzle replaces the admin panel's Diagnostics tab, so that tab and the /admin/logs endpoint behind it are removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
+7
-1
@@ -1,6 +1,6 @@
|
||||
# =============================================================================
|
||||
# nginx image — the public edge. Stock nginx plus two tools, three config
|
||||
# templates and the two partials they include.
|
||||
# templates, the two partials they include and two static includes.
|
||||
#
|
||||
# BASE: nginx:1.27, pinned to a minor version. Official nginx images are
|
||||
# multi-arch, so the same tag resolves to the arm64 build on the Raspberry Pi
|
||||
@@ -44,5 +44,11 @@ COPY nginx_routes.conf.template /etc/nginx/nginx_routes.conf.template
|
||||
# Static security-header include, referenced from nginx.conf.template (and
|
||||
# any location that sets its own add_header). Not templated — no envsubst.
|
||||
COPY security_headers.conf /etc/nginx/security_headers.conf
|
||||
# Static http-level include for the JSON request-body log (both configs). Not
|
||||
# templated: its $request_body etc. are nginx variables, not env vars.
|
||||
COPY payload_log.conf /etc/nginx/payload_log.conf
|
||||
# The payload log's directory. Normally a bind mount (./logs/nginx); created
|
||||
# here so nginx still starts when run without it.
|
||||
RUN mkdir -p /var/log/nginx/payloads
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
Reference in New Issue
Block a user