Skip to main content
Level 2
Sep 2, 2024 8:30 AM UTC
Solved

AEMasCS request not coming to custom farm dispatcher

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
ManviSharma
ManviSharmaAccepted solution
Adobe Employee
Sep 2, 2024 6:17 PM UTC

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.

9 replies

MukeshYadav_
Community Advisor
Community Advisor
Sep 2, 2024 9:49 AM UTC
EstebanBustamante
Adobe Champion and Community Advisor
Adobe Champion and Community Advisor
Sep 2, 2024 2:25 PM UTC

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/dispatcher-configuration#resolving-the-virtual-host 

 

Hope this helps

Translate
Esteban Bustamante
h_kataria
Community Advisor
Community Advisor
Sep 2, 2024 2:35 PM UTC

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.

Translate
HiteshRa3Author
Level 2
Sep 2, 2024 2:38 PM UTC

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

Translate
h_kataria
Community Advisor
Community Advisor
Sep 2, 2024 2:48 PM UTC

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.

Translate
ManviSharma
Adobe Employee
ManviSharmaAdobe EmployeeAccepted solution
Adobe Employee
Sep 2, 2024 6:17 PM UTC

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.

Translate
kautuk_sahni
Level 9
Sep 13, 2024 10:12 AM UTC

@hiteshra3 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!

Translate
Kautuk Sahni