diff roundup/cgi/client.py @ 8175:bd628e64725f

Documentation and fix for REST headers issue2551372 - Better document necessary headers for REST and fix logging to log missing Origin header.
author Ralf Schlatterbeck <rsc@runtux.com>
date Wed, 04 Dec 2024 10:45:26 +0100
parents 3f0f4746dc7e
children e84d4585b16d
line wrap: on
line diff
--- a/roundup/cgi/client.py	Tue Dec 03 10:53:32 2024 -0500
+++ b/roundup/cgi/client.py	Wed Dec 04 10:45:26 2024 +0100
@@ -719,8 +719,10 @@
         if not self.is_origin_header_ok(api=True):
             if 'HTTP_ORIGIN' not in self.env:
                 msg = self._("Required Header Missing")
+                err = 'Origin header missing'
             else:
                 msg = self._("Client is not allowed to use Rest Interface.")
+                err = 'Unauthorized for REST request'
 
             # Use code 400. Codes 401 and 403 imply that authentication
             # is needed or authenticated person is not authorized.
@@ -730,6 +732,7 @@
             self.reject_request(output,
                                 message_type="application/json",
                                 status=400)
+            logger.error(err)
             return
 
         # Handle CORS preflight request. We know rest is enabled

Roundup Issue Tracker: http://roundup-tracker.org/