Expand my Community achievements bar.

SOLVED

Sticky connections do not work

Avatar

Level 2

Hi guys!

I am trying to configure dispatcher module to use stiky connection for two pages:

/content/mysite/en/event/main.html
/content/mysite/en/event/login.html

So I added to dispatcher.any this code:

/stickyConnectionsFor "/content/mysite/en/event"
After it I restarted apache, opened a page /content/mysite/en/event/main.html in browser and saw that renderId cookie was set. Also in dispatcher.log there was this message:

Setting sticky connection to publisher_pub1
response.headers[Set-Cookie] = "renderid=publisher_pub1; path=/content/mysite/en/event;"
But when I reloaded the page and dispatcher sent my request to another publisher. New renderId cookie was set, in dispatcher log there was:

Setting sticky connection to publisher_pub1
response.headers[Set-Cookie] = "renderid=publisher_pub2; path=/content/mysite/en/event;"
Seems like dispatcher just does not read the renderId cookie and serves requests irrespective of it.

I use Apache web server version 2.2 and dispatcher module version 4.1.4. I used dispatcher 4.1.1, update it, but it did not help. Also I tried to switch off apache mod_security, it did not help too.

Could you help me, please.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Your cookie & config looks right to me. Please try [1] & also file daycare ticket.

[1]  

*   At start of dispatcher did you see message "Sticky Connections enabled"

*   Just as a trial can you rename the renderid with underscore & see if it works. Just suspecting is the parser considering underscore to be a separator.

*     One more trial try with

 /stickyConnections {
  /paths {
    "/content/mysite/en/event"
  }
}

View solution in original post

5 Replies

Avatar

Level 10

Have you by any chance configured failover in dispatcher.any ?

Avatar

Level 2

seem like no, here is my dispatcher.any file

# name of the dispatcher /name "dispatcher-prod-001" # each farm configures a set off (loadbalanced) renders /farms { # first farm entry (label is not important, just for your convenience) /mySite { # client headers which should be passed through to the render instances # (feature supported since dispatcher build 2.6.3.5222) /clientheaders { "x-via" "via" "referer" "user-agent" "authorization" "from" "content-type" "content-length" "accept-charset" "accept-encoding" "accept-language" "accept" "host" "if-match" "if-none-match" "if-range" "if-unmodified-since" "max-forwards" "proxy-authorization" "proxy-connection" "range" "cookie" "cq-action" "cq-handle" "handle" "action" "cqstats" "depth" "translate" "expires" "date" "dav" "ms-author-via" "if" "lock-token" "x-expected-entity-length" "destination" "x-forwarded-for" } # hostname globbing for farm selection (virtual domain addressing) /virtualhosts { # entries will be compared against the 'host' request header. # example: www.company.com # example: intranet.* "*" } # the load will be balanced among these render instances /renders { /publisher_pub1 { # hostname or IP of the render /hostname "..." # port of the render /port "4505" # connect timeout in milliseconds, 0 to wait indefinitely /timeout "800" } /publisher_pub2 { # hostname or IP of the render /hostname "..." # port of the render /port "4503" # connect timeout in milliseconds, 0 to wait indefinitely /timeout "800" } } # only handle the requests in the following acl. default is 'none' # the glob pattern is matched against the first request line /filter { # deny everything and allow specific entries /0001 { /type "deny"  /glob "*" } # open consoles #    /0011 { /type "allow" /glob "* /admin/*"  }  # allow servlet engine admin #    /0012 { /type "allow" /glob "* /crx/*"    }  # allow content repository #    /0013 { /type "allow" /glob "* /system/*" }  # allow OSGi console # allow non-public content directories #    /0021 { /type "allow" /glob "* /apps/*"   }  # allow apps access #    /0022 { /type "allow" /glob "* /bin/*"    } /0023 { /type "allow" /glob "* /content*" }  # disable this rule to allow mapped content only #    /0024 { /type "allow" /glob "* /libs/*"   } #    /0025 { /type "deny"  /glob "* /libs/shindig/proxy*" } # if you enable /libs close access to proxy #    /0026 { /type "allow" /glob "* /home/*"   } #    /0027 { /type "allow" /glob "* /tmp/*"    } #    /0028 { /type "allow" /glob "* /var/*"    } /0040 { /type "allow" /glob "* /libs/cq/core/content/login.html*"} # enable login-page # enable specific mime types in non-public content directories /0041 { /type "allow" /glob "* *.css *"   }  # enable css /0042 { /type "allow" /glob "* *.gif *"   }  # enable gifs /0043 { /type "allow" /glob "* *.jpg *"   }  # enable jpg /0044 { /type "allow" /glob "* *.jpeg *"   } # enable jpeg /0045 { /type "allow" /glob "* *.ico *"   }  # enable icos /0046 { /type "allow" /glob "* *.js *"    }  # enable javascript /0047 { /type "allow" /glob "* *.png *"   }  # enable png /0048 { /type "allow" /glob "* *.swf *"   }  # enable flash /0049 { /type "allow" /glob "* *.xsl *"   }  # enable xsl # enable features ..... /0064 { /type "allow" /glob "* /libs/cq/personalization/*" }  # enable personalization .... .... ... # enable .htc /0098 { /type "allow" /glob "* *.htc *"   } ... /0101 { /type "allow" /glob "* *.woff *"  } /0102 { /type "allow" /glob "* *.ttf *"   } /0103 { /type "allow" /glob "* *.svg *"   } ... /0105 { /type "allow" /glob "* *.json*"   } } # allow propagation of replication posts (should seldomly be used) /propagateSyndPost "0" # enable session management /sessionmanagement { ... } # the cache is used to store requests from the renders for faster delivery # for a second time. /cache { # the cacheroot must be equal to the document root of the webserver /docroot "..." # sets the level upto which files named ".stat" will be created in the # document root of the webserver. when an activation request for some # handle is received, only files within the same subtree are affected # by the invalidation. /statfileslevel "3" # do not cache authorized data, use session management /allowAuthorized "1" # set to 0 if you run with access restrications # Flag indicating whether the dispatcher should serve stale content if # no remote server is available. /serveStaleOnError "1" # the rules define, which pages should be cached. please note that # - only GET requests are cached # - only requests with an extension are cached # - only requests without query parameters ( ? ) are cached # - only unauthorized pages are cached unless allowUnauthorized is set to 1 /rules { /0000 { # the globbing pattern to be compared against the url # example: *         -> everything #    : /foo/bar.*    -> only the /foo/bar documents #    : /foo/bar/*    -> all pages below /foo/bar #    : /foo/bar[./]* -> all pages below and /foo/bar itself #    : *.html    -> all .html files /glob "*" /type "deny" } ... /0005 { /glob "/etc/clientlibs/*" /type "allow" } /0006 { /glob "/libs/*" /type "allow" } /0007 { /glob "/etc/designs/default/*" /type "allow" } ... /0014 { /glob "/content/mysite/en/event/*" /type "deny" } } # the invalidate section defines those pages which are 'invalidated' after # any activation. please note that, the activated page itself and all # related documents are flushed on an modification. for example: if the # page /foo/bar is activated, all /foo/bar.* files are removed from the # cache. /invalidate { /0000 { /glob "*" /type "deny" } /0001 { /glob "*.html" /type "allow" } /0002 { /glob "*.json" /type "allow" } } } # the statistics define, how the load should be balanced among the renders # according to the media-type. /statistics { /categories { /html { /glob "*.html" } /others { /glob "*" } } } /stickyConnectionsFor "/content/mysite/en/event" /retryDelay "1" /unavailablePenalty "1" } }

Avatar

Correct answer by
Level 10

Your cookie & config looks right to me. Please try [1] & also file daycare ticket.

[1]  

*   At start of dispatcher did you see message "Sticky Connections enabled"

*   Just as a trial can you rename the renderid with underscore & see if it works. Just suspecting is the parser considering underscore to be a separator.

*     One more trial try with

 /stickyConnections {
  /paths {
    "/content/mysite/en/event"
  }
}

Avatar

Level 2

Thanks you for reply!

1) Yes, I see

Sticky Connections enabled below /content/mysite/en/event for farm: mysite

2) I deleted underscore, did not help

3) seems like it is not valid config, because I did not see cookie renderid after I set this like you suggest

OK, I will contact with support.

Avatar

Level 2

I found it is works when I set sticky connections for the root of my site:

/stickyConnectionsFor "/"

But I need it for particular pages only.

Also we set url mapping for resource resolver

/content/mysite/en/</

And I request pages under /content/mysite/en/event like

http://www.example.com/event/login.html

Could it be the reason of the issue?

How I need to configure sticky connections in this case?

/stickyConnectionsFor "/event" /stickyConnectionsFor "*/event"

Both variants above do not work.