Expand my Community achievements bar.

AEM Cloud Service - Case Insensitive URLS for accessing Site pages | AEM Community Blog Seeding




AEM Cloud Service - Case Insensitive URLS for accessing Site pages by Sreekanth Choudry Nalabotu


Cloud Service Version 2022.1.6198.20220113T173638Z-211100 (Jan 13, 2022)

Apache mod_speling module can be used to configure Case Insensitivity for URLs on an onPrem AEM instance. This post is for trying the same thing on a Cloud Services AEM...

Add a filter apps.experienceaem.sites.core.filters.CaseInsensitiveURLMatchFilter with the following code. It attempts to look up the page resource by converting the URL to lower case...

package apps.experienceaem.sites.core.filters;

import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.resource.NonExistingResource;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.osgi.framework.Constants;
import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Locale;

service = Filter.class,
immediate = true,
name = "Experience AEM Case Insensitive URL Filter",
property = {
Constants.SERVICE_RANKING + ":Integer=-99",
public class CaseInsensitiveURLMatchFilter implements Filter {
private static final Logger log = LoggerFactory.getLogger(CaseInsensitiveURLMatchFilter.class);

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
SlingHttpServletRequest slingRequest = (SlingHttpServletRequest) request;
SlingHttpServletResponse slingResponse = (SlingHttpServletResponse) response;

try {
String uri = slingRequest.getRequestURI();

chain.doFilter(request, response);

Resource resource = slingRequest.getResource();

if( (resource != null) && !(resource instanceof NonExistingResource)){
chain.doFilter(request, response);

ResourceResolver resolver = slingRequest.getResourceResolver();

String resPath = uri.substring(0,uri.lastIndexOf(".html"));
resPath = resPath.toLowerCase();

resource = resolver.getResource(resPath);

if(resource != null){
RequestDispatcher dp = slingRequest.getRequestDispatcher(resPath + ".html");
dp.include(slingRequest, slingResponse);

chain.doFilter(request, response);
} catch (Exception e) {
log.error("Error finding resource : " + slingRequest.getRequestURI());

public void init(FilterConfig filterConfig) throws ServletException {

public void destroy() {

Read Full Blog

AEM Cloud Service - Case Insensitive URLS for accessing Site pages


Please use this thread to ask the related questions.

Kautuk Sahni
0 Replies