Created
November 6, 2018 13:02
-
-
Save digitalist/46ebdfd96849faca7b4804d390e55582 to your computer and use it in GitHub Desktop.
faking proxy_pass for POST logging with NGINX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pin postdata as a fake upstream log format name | |
| log_format postdata '$request_body'; | |
| server { | |
| listen 80 default_server; | |
| listen [::]:80 default_server; | |
| root /var/www/html; | |
| # Add index.php to the list if you are using PHP | |
| index index.html index.htm index.nginx-debian.html; | |
| server_name localhost; | |
| # here we fake proxypass -> sink, so we log POST data without PHP or anything | |
| location = /pixel.gif { | |
| access_log /var/log/nginx/push.log postdata; | |
| proxy_pass http://127.0.0.1/logsink; | |
| break; | |
| } | |
| # it goes here and always returns SUCCESS! | |
| location /logsink { | |
| return 200; | |
| } | |
| location / { } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment