Skip to content

Instantly share code, notes, and snippets.

@avar
Last active December 15, 2015 23:59
Show Gist options
  • Save avar/5344282 to your computer and use it in GitHub Desktop.
Save avar/5344282 to your computer and use it in GitHub Desktop.
Non-working example of clobbering credit card numbers in nginx.conf
http {
include mime.types;
log_format main '$remote_addr - $remote_user [$time_local] "$request_munged" '
'$status $body_bytes_sent $request_time/$upstream_response_time '
'"$http_referer" "$http_user_agent"';
[...]
server {
location / {
# The original request
set $request_munged $request;
# Strip some secret data out before logging it
if ($request_munged ~ /^(.*?&credit_card_number=)[^&]+(.*?)$/) {
set $request_munged "$1SEEKRT$2";
}
uwsgi_pass unix:/var/run/uwsgi/uwsgi.sock;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment