Thank you for your reply. We have iPlanet web servers which are not supported by Dynatrace officially, therefore, we adopted this manual injection technique.
What else we can do to avoid these 'Bad Requests'?
Exactly. It works with caching enabled and partially works with the caching disabled.
When we disable the cache then almost half of the AJAX calls thrown as a 'Bad Request'.