Expand my Community achievements bar.

Vanity url is not working in Dispatcher AEM 6.5 SPA

Avatar

Level 2

Hi Folks,

   I have configured a vanity path for one of the pages. It is working fine in the dev author and publish environments. However, it is not working in the dispatcher, throwing a 404 error in the network tab for the HTML and model.json files for that page.

    I have made the necessary dispatcher changes mentioned below:

 

 Farm file:

/vanity_urls {
/url "/libs/granite/dispatcher/content/vanityUrls.html"
/file "/tmp/vanity_urls"
/delay 300
}

 

Filter rule:

#allow vanity urls list path
/0101 { /type "allow" /extension 'html' /path "/libs/granite/dispatcher/content/vanityUrls" }

 

However, when I hit the vanity path in the dispatcher, it redirects to the page and then again redirects to a 404 error page. Please help me on this issue to resolve, Thanks in advance!

 

 

2 Replies

Avatar

Level 6

hi @jooca, try if this can help https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/libs-granite-dispatcher-co... 

 

Besides check dispatcher configurations:

  • Ensure that the vanity_urls section in the farm file is correctly pointing to the appropriate resource. Check if the path /libs/granite/dispatcher/content/vanityUrls.html is accurate and accessible from the dispatcher. 
  • Review the filter rule to confirm it correctly allows access to the necessary paths. The rule should specifically target the vanity URLs and their associated files to ensure they are properly served.
  • Ensure the dispatcher is configured to handle requests for the specific vanity paths. Verify that the mappings are correctly synchronized from the AEM author to the dispatcher.
  • Review the dispatcher logs to identify why the files are returning 404 errors. Look for clues regarding incorrect paths or missing files.
  • Ensure that the vanity paths are correctly cased and consistent with the expected URLs. Variations in case can cause the dispatcher to fail in locating the resources.

Another interesting tool you could consider is Vanity Path Rewrite Mapper from ACS Commons.

 

Hope this help!

 

 

Avatar

Community Advisor

Hi @jooca ,

1. Dispatcher Vanity URLs Setup (Core)

Already have this — just double-confirm:

/vanity_urls {
    /url    "/libs/granite/dispatcher/content/vanityUrls.html"
    /file   "/tmp/vanity_urls"
    /delay  300
}

Verify

Hit https://<publish-host>/libs/granite/dispatcher/content/vanityUrls.html

Should list all your vanity paths. If empty ➜ flush cache / restart Dispatcher

2. FILTER Rules – Allow Everything Needed

Update filters in dispatcher.any (or vhost if using Apache rules):

# Allow vanityUrls.html access
/0101 { /type "allow" /method "GET" /extension 'html' /path "/libs/granite/dispatcher/content/vanityUrls" }

# Allow HTML & JSON (SPA) for all content
/0102 { /type "allow" /method "GET" /extension '(html|json)' /path "/content/your-site/.*" }

# Allow root-level vanity URLs if applicable (no /content prefix)
/0103 { /type "allow" /method "GET" /extension '(html|json)' /path "/vanity-path/.*" }

# Allow model.json (SPA needs it)
# Handles /content/site/page.model.json
/0104 { /type "allow" /method "GET" /path "*/model.json" }

Important: Update /content/your-site/.* to match your site’s actual path

3. CACHE Rules (SPA needs .html + .json)

Ensure cache allows this

/cache {
  /rules {
    /0001 { /glob "*.html" /type "allow" }
    /0002 { /glob "*.json" /type "allow" }
  }
}

4. statfileslevel = 2 (Required for SPA Routing)

SPA routing needs statfileslevel to be at least 2, for correct cache invalidation:

/statfileslevel "2"

5. Flush Dispatcher Cache for Vanity URL File

Manually delete:

/tmp/vanity_urls

Then re-hit:

https://<publish-host>/libs/granite/dispatcher/content/vanityUrls.html

Confirm /tmp/vanity_urls regenerates.

6. Dispatcher Logs = Goldmine for Debug

Run this to see real-time issues:

tail -f logs/dispatcher.log


Regards,
Amit