Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

AEMasCS request not coming to custom farm dispatcher

Avatar

Level 3

I have created a custom farm abc.farm in the dispatcher config and created a symlink under enabled_farms

The issue is when I hit any page in local dispatcher, I see the request coming to the default_farm and not to my custom farm

However, if I rename the abc.farm to xyz.farm( to make sure the file is included below the default_farm) then I see the requests coming to my custom xyz.farm in the dispatcher logs

Not working scenario - 

 

| - /available_farms 
    | - abc.farm 
    | - default.farm

 

Working scenario - 

 

| - /available_farms 
    | - default.farm 
    | - xyz.farm

 

What could be the reason for this

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi,

To ensure your custom farm (abc.farm) is processed after the default farm, you can either:

  1. Rename the Farm File:

    • Rename abc.farm to something that alphabetically follows default.farm, such as xyz.farm.
  2. Explicitly Control Inclusion Order:

    • Modify the dispatcher configuration to explicitly include abc.farm after default.farm.

Example Configuration

Assuming your dispatcher configuration file is dispatcher.any, you can control the inclusion order like this:

# dispatcher.any

/available_farms {
    /farms {
        "/default" {
            $include "/path/to/available_farms/default.farm"
        }
        "/abc" {
            $include "/path/to/available_farms/abc.farm"
        }
    }
}

In this example, default.farm is explicitly included before abc.farm, ensuring the desired order of processing.

View solution in original post

9 Replies

Avatar

Community Advisor

Hi, 

Most likely you have an issue with your virtualHosts, please check how the farms and virtualHosts are resolved, this will clarify your doubts: https://experienceleague.adobe.com/en/docs/experience-manager-dispatcher/using/configuring/dispatche... 

 

Hope this helps



Esteban Bustamante

Avatar

Community Advisor

Your default farm generally has a catch-all vhost configuration which means if a request is coming from a vhost which is not matched, it will by default go to that farm. 
Since you are calling it from your local, if you have not set up a vhost it will by default go to the default farm itself. 

You will probably have to setup a virtual host on your local (on widows you can do that by editing host file c:\WINDOWS\system32\drivers\etc\hosts), provide proper vhost entries in dispatcher config and then use that host to call the page. 
Hope this helps.

Avatar

Level 3

But how does it work when I change the order of how the files are included, when I place the default_farm on top then I see the request coming to my custom farm

Avatar

Community Advisor

I would assume both your farms have similar entries for virtualhost (probably {"*"}), so dispatcher picks up the lowest farm entry by default as it will be a match. You can cross check that once.

Avatar

Level 3

No they are different, I also checked by removing the virtualhost section but still I dont see any changes

Avatar

Community Advisor

Even then as I mentioned default farm has catch-all configuration, and vhost evaluation is done from the bottom most farm, so if you will place your default-farm at the bottom, none of the other farms will be evaluated. Hence it is recommended to keep the default farm at the top

Therefore, you should place your default virtual host at the top of the virtualhosts property. PLace it in the topmost farm of your dispatcher.any file.



Avatar

Correct answer by
Employee Advisor

Hi,

To ensure your custom farm (abc.farm) is processed after the default farm, you can either:

  1. Rename the Farm File:

    • Rename abc.farm to something that alphabetically follows default.farm, such as xyz.farm.
  2. Explicitly Control Inclusion Order:

    • Modify the dispatcher configuration to explicitly include abc.farm after default.farm.

Example Configuration

Assuming your dispatcher configuration file is dispatcher.any, you can control the inclusion order like this:

# dispatcher.any

/available_farms {
    /farms {
        "/default" {
            $include "/path/to/available_farms/default.farm"
        }
        "/abc" {
            $include "/path/to/available_farms/abc.farm"
        }
    }
}

In this example, default.farm is explicitly included before abc.farm, ensuring the desired order of processing.

Avatar

Administrator

@hr-empd Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!



Kautuk Sahni