Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

dispatcher farm conf in virtualhost

Avatar

Level 2

hi I am setting up a site caselaw,lp.findlaw.com for my company in cq5. basically based on the urls i want them to go to different servers.

it's working good when there is no query string involved, but what can i do to tell the dispatcher to include the pattern even after the "?"

caselaw.lp.findlaw.com/index.html --> working good (go to server whatever1)

caselaw,lp.findlaw.com/data2/something.html --> working good (go to server whatever2)

caselaw,lp.findlaw.com/ca/something.html --> working good (go to server whatever2)

caselaw,lp.findlaw.com/scripts/getcase.pl?court=fedclaim --> not working (still going to server whatever1)

http://caselaw.lp.findlaw.com/1/fedclaim/1 --> working (go to server whatever2)

http://caselaw.lp.findlaw.com/1.html?/fedclaim/1 --> not working (still going to server whatever1)

 

here is my entire farm conf for the site, can you tell me whether it's doable or how should i have done?

 

  /farm_caselawlp1
    { 
    # Request headers that should be forwarded to the remote server.
    /clientheaders
      {
      # Forward all request headers that are end-to-end. If you want
      # to forward a specific set of headers, you'll have to list
      # them here.
      "*"
      }
     
    # Hostname globbing for farm selection (virtual domain addressing)
    /virtualhosts
      {
      # Entries will be compared against the "Host" request header
      # and an optional request URL prefix.
      #
      # Examples:
      #
      #   www.company.com
      #   intranet.*
      #   myhost:8888/mysite
      "caselaw.lp.findlaw.com"
      }
     
    # The load will be balanced among these render instances
    /renders
      {
                $include "renders.any"
      }
     
    # The filter section defines the requests that should be handled by the dispatcher.
    # The globs will be compared against the request line, e.g. "GET /index.html HTTP/1.1".
    /filter
      {
                $include "filters.any"
      }

    # The cache section regulates what responses will be cached and where.
    /cache
      {
      # The docroot must be equal to the document root of the webserver. The
      # dispatcher will store files relative to this directory and subsequent
      # requests may be "declined" by the dispatcher, allowing the webserver
      # to deliver them just like static files.
      /docroot "/flocal/cache/apache/htdocs/content/public/caselawlp"

          #$include "cache.any"
          $include "no_cache.any"
         
      }
     
    # The statistics sections dictates how the load should be balanced among the
    # renders according to the media-type.
    /statistics
      {
            $include "statistics.any"
      }
    }
  /farm_caselawlp2
    { 
    # Request headers that should be forwarded to the remote server.
    /clientheaders
      {
      # Forward all request headers that are end-to-end. If you want
      # to forward a specific set of headers, you'll have to list
      # them here.
      "*"
      }
     
    # Hostname globbing for farm selection (virtual domain addressing)
    /virtualhosts
      {
      # Entries will be compared against the "Host" request header
      # and an optional request URL prefix.
      #
      # Examples:
      #
      #   www.company.com
      #   intranet.*
      #   myhost:8888/mysite
      "caselaw.lp.findlaw.com/ca/*"
      "caselaw.lp.findlaw.com/data2/*"
      "caselaw.lp.findlaw.com/scripts/callaw*"
      "caselaw.lp.findlaw.com/*court=fedclaim*"
      "caselaw.lp.findlaw.com/*/fedclaim/*"
      }
     
    # The load will be balanced among these render instances
    /renders
      {
                /caselaw-server
        {
                # Hostname or IP of the render
                /hostname "66.35.204.41"
                # Port of the render
                /port "80"
                # Connect timeout in milliseconds, 0 to wait indefinitely
                /timeout "0"
        }
      }
     
    # The filter section defines the requests that should be handled by the dispatcher.
    # The globs will be compared against the request line, e.g. "GET /index.html HTTP/1.1".
    /filter
      {
                $include "filters.any"
      }

    # The cache section regulates what responses will be cached and where.
    /cache
      {
      # The docroot must be equal to the document root of the webserver. The
      # dispatcher will store files relative to this directory and subsequent
      # requests may be "declined" by the dispatcher, allowing the webserver
      # to deliver them just like static files.
      /docroot "/flocal/cache/apache/htdocs/content/public/caselawlp"

          #$include "cache.any"
          $include "no_cache.any"
         
      }
     
    # The statistics sections dictates how the load should be balanced among the
    # renders according to the media-type.
    /statistics
      {
            $include "statistics.any"
      }
    }

1 Accepted Solution

Avatar

Correct answer by
Employee

You can do it at apache. 

View solution in original post

14 Replies

Avatar

Level 2

the url is coming from old site and we are migrating it to cq5. so the url could be caselaw.lp.findlaw.com/scripts/getcase.pl?type=search&court=/data/fedclaim/1.html

i can't change the url.

Avatar

Correct answer by
Employee

You can do it at apache. 

Avatar

Level 2

so there is no way in the conf in those farm setup?

Avatar

Employee

I dont see a better way.Apache rewrite module can handle a lot of rewrites(more than 100K). It wont affect the performance much. From your requirement, just a few rules should be enough.

Avatar

Level 2

I can't really do that, let me give you a little bit more info.

all caselaw.lp.findlaw.com's traffic is coming to cq5 but when it has something like getcase.pl?....court=fedclaim, the traffic should return back to the old server.

the easy way is to set it in the farm conf, and can't really do it in apache conf. the traffic would be eventually be redirected back to cq5.

ex: http://caselaw.lp.findlaw.com/scripts/getcase.pl?vol=1999/9764c&court=fedclaim --> with the apache rewriteRule, it should still go back to caselaw.lp.findlaw.com and then cq5.

is there anything else I can do?

thanks in advance.

Avatar

Employee

If I understand correctly, you want all of the traffic to caselaw.lp.findlaw.com to come into your httpd server (i.e. Dispatcher), but you do not want your AEM Publish instances to handle some specific requests right now. But eventually you do.

For the short term (i.e. while you still want some requests routed to the old server), couldn't you use mod_proxy for this?

e.g.

ProxyPass         /scripts/ http://previousbackendserverdomain/scripts/ ProxyPassReverse  /scripts/ http://previousbackendserverdomain/scripts/

If your need is more complicated than just redirecting everything going to /scripts to the old server (i.e. some queries you want to rewrite so they are served by the Publish instances), then you would use ProxyPassMatch instead of ProxyPass so you could make use of regular expression matching.

Then you would have to do use mod_rewrite for the ones you want to rewrite and be served by the AEM Publish instances.

Avatar

Level 2

hi thanks for the suggestion, but I am not very familiar with proxyPass. lets say I want everything else go to cq5 but in the following example http://caselaw.lp.findlaw.com/scripts/getcase.pl?vol=1999/9764c&court=fedclaim, it goes back to the old server. I would assume they are ok to say in the same VirtualHost setup right? here is what I have, but it doesn't seem to be working...

<VirtualHost *>
  DocumentRoot /flocal/cache/apache/htdocs/content/caselawlp
  ServerName caselaw.lp.findlaw.com
  FileETag None

  RewriteEngine  on
  Include conf/vconf/redirect/caselawlp

  ProxyPreserveHost On
  ProxyPassMatch ^/(.*court=fedclaim.*)$ http://caselaw.lp.findlaw.com/$1

  RewriteCond %{REQUEST_URI} ^/content
  RewriteCond %{REQUEST_URI} !^/content/dam
  RewriteRule ^ /not_found.html [PT]
</VirtualHost>

Avatar

Employee

You don't need proxy pass. You jut need a rewrite rule to this.

Avatar

Level 2

see my earlier post, I can't really do that. it wasn't working since it's going to same dns. caselaw.lp.findlaw.com/....

Avatar

Employee

I want to understand your infra arch diag for both the servers and LB. For LB --> you just need to talk to your infra admin and they would do. But only if both legacy and new CQ sites have same domain. If they have different domains, you need to use proxypass.

Avatar

Level 2

i am not sure that i am getting this. you meant doing this in old server? and i am not sure how to control the traffic in the load balancer?

 

kalyanar wrote...

So basically, if they have the same domains, at the LB you can do that. Google for layer 7 rules. F5 LB does it.Load Balancer receives all end user requests and can route each request to either the AEM Web Server (which is running the dispatcher) or the ``Legacy'' Web Server. At LB , create two pools and apply rules. hope this helps.

switch -glob [HTTP::uri] {
  "/content/caselaws/*" -
  "/etc/*" {
    pool aem
  }
  default {
    pool legacy
  }
}

 

Avatar

Employee

Apologies. I only looked the last mail in the thread.  The old server has a different domain to the new server? 

Avatar

Employee

So basically, if they have the same domains, at the LB you can do that. Google for layer 7 rules. F5 LB does it.Load Balancer receives all end user requests and can route each request to either the AEM Web Server (which is running the dispatcher) or the ``Legacy'' Web Server. At LB , create two pools and apply rules. hope this helps.

switch -glob [HTTP::uri] {
  "/content/caselaws/*" -
  "/etc/*" {
    pool aem
  }
  default {
    pool legacy
  }
}