Hi @raju_komari ,
sendRedirect() puts your entire azureRegistrationUrl into the Location response header. On AEM as a Cloud Service, that header goes through the CDN / Jetty chain, which has hard limits on header size (typically 8–16 KB total). Once the Location header (plus others) crosses that limit, the proxy returns a 502 before AEM logs anything.
You cannot tune these limits in AEMaaCS (unlike on‑prem). See the general guidance on header/URL limits in AEMaaCS: https://experienceleague.adobe.com/en/docs/experience-cloud-kcs/kbarticles/ka-22193
Try below solution:
Stop using sendRedirect() for that long URL and do a client‑side redirect instead:
- Return a small HTML page from your filter.
- That page uses JavaScript (or meta refresh) to navigate to azureRegistrationUrl.
Example:
String target = azureRegistrationUrl; // very long URL
response.setStatus(HttpServletResponse.SC_OK);
response.setContentType("text/html;charset=UTF-8");
String html = "<!DOCTYPE html><html><head>" +
"<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'self'; script-src 'self' 'unsafe-inline'\">" +
"<script>window.location.href='" + org.apache.commons.lang3.StringEscapeUtils.escapeEcmaScript(target) + "';</script>" +
"</head><body></body></html>";
response.getWriter().write(html);
- The response headers stay small (no huge Location header).
- The browser then performs the actual navigation to the long Azure URL, bypassing the AEM/CDN header limit.
If you can change the Azure side, also consider:
- Shortening the redirect URL (use a small state token + server‑side lookup instead of encoding everything in query params).
But with today’s AEMaaCS constraints, the only reliable fix on the AEM side is to avoid long Location headers and use a client‑side redirect page as shown above.
Thanks,
Amit