Expand my Community achievements bar.

SOLVED

Issues with vanity_url rule on dispatcher

Avatar

Level 2

Hi All,

Have you used the following rules anytime at dispatcher?

/vanity_urls {    

     /url "/libs/granite/dispatcher/content/vanityUrls.html"  

       /file "/tmp/vanity_urls" 

        /delay 300

}

In our project we have allowed only certain pattern of url to be served from dispatcher. However vanity URL does not follow this pattern.

Documentation says that if we use above rule in the dispatcher then it would allow vanity URLs even though the pattern is not allowed in filter section. The problem that I am facing is , file "/tmp/vanity_urls" is not being created even though the dispatcher has write access. Can anybody let me know if they have faced the same issue ?

P.S : I have installed VanityURLS-Components and if I create  “/tmp/vanity_urls" manually and add vanity URLs , then the functionality is working fine. Issue is the vanity_urls file is not being created/updated periodically.

Env Details :

CQ : 5.6.1

Webserver : IBM Httpserver 7.0 ( 32 bit )

Dispatcher : dispatcher-apache2.2-linux-i686-4.1.11.tar.gz

Regards,

Anand

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Have you verified the following URL works on the render instance - /libs/granite/dispatcher/content/vanityUrls.html ? Also, in the access.log file of the renderer find this URL and see if it is getting called after every 300 sec or not. If it is not getting called then enable debug [1] log level on dispatcher and monitor the dispatcher logs. 

If you do not see any message in the dispatcher log file as well then it will be good to raise this issue with on the day care support portal https://daycare.day.com/home/createaticket.html

[1] https://helpx.adobe.com/experience-manager/kb/troubleshooting-dispatcher-flushing-issues.html

View solution in original post

15 Replies

Avatar

Correct answer by
Employee Advisor

Have you verified the following URL works on the render instance - /libs/granite/dispatcher/content/vanityUrls.html ? Also, in the access.log file of the renderer find this URL and see if it is getting called after every 300 sec or not. If it is not getting called then enable debug [1] log level on dispatcher and monitor the dispatcher logs. 

If you do not see any message in the dispatcher log file as well then it will be good to raise this issue with on the day care support portal https://daycare.day.com/home/createaticket.html

[1] https://helpx.adobe.com/experience-manager/kb/troubleshooting-dispatcher-flushing-issues.html

Avatar

Level 2

/libs/granite/dispatcher/content/vanityUrls.html  is accessible and returns the list of available vanity url. but I don’t see any logs writing in access.log or dispatcher log files regarding ‘vanityUrls.html”

Avatar

Level 3

anandr1644048 wrote...

/libs/granite/dispatcher/content/vanityUrls.html  is accessible and returns the list of available vanity url. but I don’t see any logs writing in access.log or dispatcher log files regarding ‘vanityUrls.html”

 

 

Hi anandr1644048,

When you call /libs/granite/dispatcher/content/vanityUrls.html are you calling it via the publish instance directly or via the dispatcher?  

I noticed that when I call localhost:4503/libs/granite/dispatcher/content/vanityUrls.html I get a 404 returned even though I installed the Vanity URLs components.  If I log into the publish instance and try again it correctly accesses the URL.  However when I call via the dispatcher, I get a 404.

So it seems that the call requires authentication.  When I request my vanity URL via dispatcher at publish.kristian.com/ktest I get the following in the dispatcher.log:

[Fri Jan 29 12:53:56 2016] [D] [75615(140735164698624)] Found farm publish for publish.kristian.com [Fri Jan 29 12:53:56 2016] [D] [75615(140735164698624)] checking [/ktest] [Fri Jan 29 12:53:56 2016] [D] [75615(140735164698624)] request URL has no extension: /ktest [Fri Jan 29 12:53:56 2016] [D] [75615(140735164698624)] cache-action for [/ktest]: NONE [Fri Jan 29 12:53:56 2016] [D] [75615(140735164698624)] Checking vanity URLs [Fri Jan 29 12:53:56 2016] [D] [75615(140735164698624)] Vanity URL file (/Library/WebServer/Documents/publish/vanity_urls) not found, fetching... [Fri Jan 29 12:53:56 2016] [W] [75615(140735164698624)] Unable to fetch vanity URLs from localhost:4503/libs/granite/dispatcher/content/vanityUrls.html: remote server returned: HTTP/1.1 404 Not Found [Fri Jan 29 12:53:56 2016] [D] [75615(140735164698624)] Filter rejects: GET /ktest HTTP/1.1 [Fri Jan 29 12:53:56 2016] [I] [75615(140735164698624)] "GET /ktest" - - 7ms

and this is my access.log on the publish instance:

0:0:0:0:0:0:0:1 - anonymous 29/Jan/2016:13:10:42 +0800 "GET /libs/granite/dispatcher/content/vanityUrls.html HTTP/1.1" 404 126 "-" "-"

If I try and access the URL in my browser while logged into the publish instance via localhost:4503/libs/granite/dispatcher/content/vanityUrls.html this is the line in the access.log:

0:0:0:0:0:0:0:1 - admin 29/Jan/2016:13:13:25 +0800 "GET /libs/granite/dispatcher/content/vanityUrls.html HTTP/1.1" 200 7 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36"

and I also have the correct output of /ktest on the screen from the Vanity URL component.

 

So it seems that either authentication is required for the call, or ACLs need to be updated to allow anon access to /libs/granite/dispatcher/content/vanityUrls.  Did you need to do this to get it working?

I'm running:

  • AEM 6.1
  • Apache 2.4
  • Dispatcher 4.1.11

 

Thanks,
Kristian

Avatar

Level 3

For clarification, I'm running dispatcher 4.1.11 Darwin (OSX).

Avatar

Level 2

Hi Kristian,

I have copied /libs/granite/dispatcher/content/vanityUrls.html  to /content/vanityUrls.html and using /content/vanityUrls.html in the dispatcher configuration and i could able to hit /content/vanityUrls.html URL from the dispatcher without logging in.

When i restart my server and there is no vanity url text file in the server , then dispatcher hits /content/vanityUrls.html and stores the vanity url at tmp location and servers vanity URL. but any changes after the restart , is not being picked up by the server (  periodic vanity URL sync is not being performed )

Regards,

Anand

Avatar

Level 3

Hi Anand,

Thanks for the update.  I created a Daycare ticket about this, and they suggested adding a read permission to the 'everyone' group for the node '/libs/granite/dispatcher/content/vanityUrls'.  This works, as does your solution.

I also needed to make some other changes that were not documented, such as allowing /libs/granite/dispatcher/content/vanityUrls in the dispatcher filter rules, and also ensuring it was not being cached.

As to your initial question above regarding the file defined in /file not being created, it turns out that it's not automatically happening every /delay seconds, but rather only when a page that fails the filter is being requested.  So this explains why it's sometimes being written and updated - the /delay is not how often the dispatcher checks, but rather how old the file can be to be considered out of date before fetching an updated version.

I've blogged about this complete solution here:  https://blog.kristianwright.com/2016/02/11/aem-dispatcher-and-vanity-urls/

Thanks,
Kristian

Avatar

Level 2

Hi Kristian,

For the first time after my server restart, the vanity_url file is created when i tried accessing vanity URL from my browser. but later the file is not being refreshed even after i waited for an hour and hit new vanity URL that i configured. below is my setting in dispatcher.any

/vanity_urls {
     /url "/content/vanityUrls.html"
     /file "/tmp/vanity_urls"
     /delay 200
    }

Regards,

Anand

Avatar

Level 3

Hi Anand,

For debugging, set delay to 60, and your dispatcher log to debug.  If you can post the dispatcher log when you try and access the vanity URL that might give a clue as to why it's not updating...

Overall you should not need to restart the server, only restart apache after changing configurations.

Cheers,
K

Avatar

Level 2

Hi Kristian,

I have set the delay to 60 and restarted my apache. I have updated a vanity URL in one of the page and published. After waiting for 30 min and when I tried to access vanity url , it’s going to 404.

Following is the dispatcher log.

[Fri Feb 12 23:09:12 2016] [D] [7672(2900)] Found farm website for www.localhost [Fri Feb 12 23:09:12 2016] [D] [7672(2900)] checking [/my-smart-url] [Fri Feb 12 23:09:12 2016] [D] [7672(2900)] request URL has no extension: /my-smart-url [Fri Feb 12 23:09:12 2016] [D] [7672(2900)] cache-action for [/my-smart-url]: NONE [Fri Feb 12 23:09:12 2016] [D] [7672(2900)] refresh_vanity_urls: up-to-date (next check: 18443758385699362565, current: 0) [Fri Feb 12 23:09:12 2016] [D] [7672(2900)] Filter rejects: GET /my-smart-url HTTP/1.1 [Fri Feb 12 23:09:12 2016] [I] [7672(2900)] "GET /my-smart-url" - - 1ms

Regards,

Anand

Avatar

Level 3

Hi Anand,

Try setting the read property for the group 'everyone' on the /libs/granite/dispatcher/content/vanityUrls node, and update your dispatcher /url setting to /libs/granite/dispatcher/content/vanityUrls.html

This is how Daycare suggested to solve it and it's working for me.  Also don't forget to allow that path in the dispatcher filter and also prevent it from being cached.

Cheers
K

Avatar

Level 1

Hi Kristian,

I have followed your blog and set up everything as given. But I am also getting same problem. First time the temp file gets created properly. But It is not getting updated when we introduced new vanity url.

Could you please suggest here.

 

Thanks & Regards,

Vijay

Avatar

Level 1

Hi Anand,

Have you found the solution . Any luck?

Thanks & Regards,

Vijay

Avatar

Level 1

Hi,

I am not able to access vanity url s starts with home ex:/homecare, /homehealth any string starts with home.

I commented the entry

RewriteCond %{REQUEST_URI} !^/home

in dispatcher  stilL it is not resolved.please help on this

Avatar

Level 2

Hi,

I tried localhost:4503/libs/granite/dispatcher/content/vanityUrls.html and it lists all the vanity urls and also I can access the vanity url though localhost:4503/testVanityUrl.html but still not able to access via dispatcher and got 404 error - "Unable to fetch vanity URLs from localhost:4503/libs/granite/dispatcher/content/vanityUrls.html: remote server returned: HTTP/1.1 404 Not Found".

I have already given the READ permission to "everyone" group as well as to "anonymous" user but no luck. I have allowed the path in /filter section but not sure if anything needs to be done in /cache section.

Please suggest.

Thanks,

Jitendra

Avatar

Level 2

check if your dispatcher blocking your request.. check in the filter section or enable the debug logs in the dispatcher and see what is the exact error.