Vanity URL working inconsistently
Hi All,
I am facing weird issue of Vanity url which works for some urls and does not for some of them.
The Urls are unique in the AEM application.
for Example:
https://www.site-A/en/vanity-url-one.html =>sling:vanityPath configured abc.html works when accessed https://www.site-A/abc.html
but another page:
https://www.site-A/en/vanity-url-two.html =>sling:vanityPath configured xyz.html does not works when accessed https://www.site-A/xyz.html
We can see in the error log stating the resource doesn't exists.
Also sling resource resolver resolves the page https://www.site-A/abc.html but doesn't resolves the page https://www.site-A/xyz.html
I have installed the vanity url component on the publish instance and have configured the dispatcher according to adobe documentations
Also used this link for the setup.
Has anyone faced this issue?
the problem looks to be how vanity url work along with dispatcher. The vanity url http://localhost:4503/xyz works fine directly on publisher
But the same page over dispatcher url https://www.site-A/xyz doesnt works, but having https://www.site-A/test-vanity-url-another works fine.
Attaching the error log response, the dispatcher vanity url(https://www.site-A/libs/granite/dispatcher/content/vanityUrls) service response and the configured vanity url
04.08.2020 11:27:19.137 *INFO* [127.0.0.1 [1596533239134] GET /xyz.html HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Resource /content/site-A/xyz.html not found


vhost configuration:
<VirtualHost *:80>
ServerName www.site-A
Header set Host "www.site-A"
<Directory /Users/subrato.kha/dispatcher-cache/site-A>
<IfModule disp_apache2.c>
SetHandler dispatcher-handler
ModMimeUsePathInfo On
</IfModule>
Options FollowSymLinks
AllowOverride None
# Apache httpd 2.2
# Order allow,deny
# Allow from all
# Apache httpd 2.4
Require all granted
</Directory>
DocumentRoot "/Users/subrato.kha/dispatcher-cache/site-A"
ErrorLog "/private/var/log/apache2/www.site-A-error_log"
CustomLog "/private/var/log/apache2/www.site-A-access_log" common
# Rewrite rules for removing html from extension
# Handle requests to pages ending with a trailing slash
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/content/dam
RewriteCond %{REQUEST_URI} .*/$
RewriteCond %{REQUEST_URI} !^/$
RewriteRule (.*)/$ $1.html [PT,L,QSA]
# Handle requests to pages ending without a trailing slash
RewriteCond %{REQUEST_URI} !^/content/dam/.*
RewriteCond %{REQUEST_URI} !.*\..*$
RewriteCond %{REQUEST_URI} !.*/$
RewriteRule (.*)$ $1.html [PT,L,QSA]
#redirect /file.html to /file
RewriteCond %{THE_REQUEST} /([^.]+)\.html [NC]
RewriteRule ^ /%1 [NE,L,R=301]
</VirtualHost>