Servlet-filter : Prevent the deletion of a custom field

Hello everyone,

I am trying to add a ‘servlet filter’ to prevent the deletion of specific custom fields.

It seems that when attempting to delete a custom field through the API (/rest/api/2/customFields) on the secure/admin/ViewCustomFields.jspa page, the error message is not being displayed successfully despite the prevention mechanism working as intended. The issue becomes apparent specifically after transitioning to a Data Center environment.

Could you please give me some practical techniques to solve this mystery?

additional info:
url patterns used:

/rest/api/2/customFields*

To display the message:

httpResponse.getWriter().write(“Unable To Delete !”);