Custom servlet causes an increase in content requests in AEM as a Cloud Service
A custom servlet in Adobe Experience Manager (AEM) as a Cloud Service appears in content-request reports when it returns successful responses with HTML or JSON content. An increase in these responses can cause a noticeable spike in reported content requests, especially when the servlet previously returned mostly redirects or other excluded status codes. To address the increase, review the servlet and Dispatcher configurations, compare response volumes, and verify that each response uses the status code appropriate for the servlet’s behavior.
Description description
Environment
- Adobe Experience Manager as a Cloud Service
- Custom servlets
- Dispatcher
- Content-request reports
Issue/Symptoms
- A custom servlet endpoint begins appearing in content-request reports.
- Content-request counts increase suddenly without recent code or configuration changes.
- CDN or server logs show a higher volume of
200 OKresponses from the servlet. - The servlet previously returned mostly
301responses or other excluded HTTP status codes.
Cause
AEM as a Cloud Service counts 200 OK responses that return full or partial HTML or JSON content as content requests. Redirect responses in the HTTP 300–399 range and other excluded status codes aren’t counted. When a servlet starts returning more 200 OK responses, the endpoint appears in the content-request metrics and can increase the reported count.
Resolution resolution
Follow the steps below to investigate and address the increase in content requests:
- Review the custom servlet and Dispatcher configurations and identify changes that affect the servlet’s response codes.
- Analyze the CDN or server logs to identify the servlets returning
200 OKresponses. - Review the log entries for the affected servlet endpoints and compare the volume of
200 OKresponses before and after the increase in content requests. - Review the AEM documentation to identify the HTTP response codes and content types included in or excluded from content-request calculations.
- Verify that the servlet returns the HTTP status code appropriate for its intended behavior. If the servlet is intended to redirect the request, update its implementation or Dispatcher configuration to return a
301redirect or another appropriate redirect status. - If the servlet is intended to return HTML or JSON successfully, retain the appropriate successful response and investigate the source of the increased request volume.
- After making the required changes, monitor the content-request reports and verify whether the servlet’s reported request volume changes as expected.