LogProx uses a YAML configuration file to define logging, request dropping, and response logging rules. The configuration supports environment variable substitution using ${VAR_NAME} syntax.
Environment variables:
CONFIG_FILE— path to the config file (default:config.yaml)PORT— server port (default:3000)
server:
port: 3000 # overridden by PORT env varlogging:
default: false # log all requests if no rules match
rules:
- name: "Log API calls"
match_conditions:
path:
patterns: ["httpbin.org.*"] # regex, at least one must match
methods: ["POST", "PUT"] # method must be in list (if specified)
headers:
"content-type": "application/json.*" # all headers must match (regex)
body:
patterns: [".*"] # regex, at least one must match
capture:
headers: ["content-type"] # which request headers to log
body: true
method: true
path: true
timing: true
timeout: 30s # per-request upstream timeout (e.g. 30s, 500ms)drop:
default: false # drop all requests if no rules match
rules:
- name: "Block deprecated endpoint"
match_conditions:
path:
patterns: ["/api/v1/deprecated.*"]
response:
status_code: 410
body: "Gone. Use /api/v2." # supports ${ENV_VAR} substitutionresponse_logging:
default: false # log all responses if no rules match
rules:
- name: "Log errors"
match_conditions:
status_codes: [400, 401, 403, 404, 500, 502, 503]
headers:
"content-type": "application/json.*"
body:
patterns: ["error.*"]
capture:
headers: ["content-type", "x-request-id"]
body: true
status_code: true
timing: trueupstream:
allow_private_networks: false # block 127.x, 10.x, 192.168.x, etc. (default: false)
allowed_schemes: ["http", "https"] # default
allowed_hosts: [] # if non-empty, only these hosts are permitted (exact match)
denied_hosts: [] # always blocked regardless of other settings- Methods: request method must appear in list (case-insensitive). Empty list = any method.
- Path patterns: regex. At least one must match. Empty list = any path.
- Headers: all specified headers must match their regex pattern.
- Body patterns: regex. At least one must match. Empty list = any body.
- Rule evaluation: first matching rule wins.
GET /health— health check, returns200 OKGET /config— current configuration as JSONGET /config/docs— this documentationPOST /config/reload— reload configuration from file