From da4aa10d6fb89ca970fa23bd4eed92d4cdeb770f Mon Sep 17 00:00:00 2001 From: Kimotu Bates <45389306+Kimotu@users.noreply.github.com> Date: Wed, 28 Apr 2021 22:41:51 +0200 Subject: [PATCH] Fixed expected mime-type (#1807) Chrome and Firefox report CSP as application/csp-report and not application/json. This lead to HTTP 400 BAD REQUEST. No csp logs were created. With this fix, the form is csp report is processed and written to logs. --- www/nginx/src/opnsense/scripts/nginx/csp_report.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/nginx/src/opnsense/scripts/nginx/csp_report.php b/www/nginx/src/opnsense/scripts/nginx/csp_report.php index 303eed985..116707a09 100755 --- a/www/nginx/src/opnsense/scripts/nginx/csp_report.php +++ b/www/nginx/src/opnsense/scripts/nginx/csp_report.php @@ -29,7 +29,7 @@ $log_file = '/var/log/nginx/csp_violations.log'; // make sure we don't have any formatting issues here -if (stristr($_SERVER['CONTENT_TYPE'], 'json') === false) { +if (stristr($_SERVER['CONTENT_TYPE'], 'csp-report') === false) { http_response_code(400); echo "This endpoint expects JSON data. Please send data using a json mime time (for example application/json)"; exit(0);