<td>Balancer sticky session name. The value is usually set to something
like <code>JSESSIONID</code> or <code>PHPSESSIONID</code>,
and it depends on the backend application server that support sessions.
+ If the backend application server uses different name for cookies
+ and url encoded id (like servlet containers) use | to to separate them.
+ The first part is for the cookie the second for the path.
</td></tr>
<tr><td>timeout</td>
<td>0</td>
<p>A sample balancer setup</p>
<div class="example"><p><code>
ProxyPass /special-area http://special.example.com/ smax=5 max=10<br />
- ProxyPass / balancer://mycluster/ stickysession=jsessionid nofailover=On<br />
+ ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid nofailover=On<br />
<Proxy balancer://mycluster><br />
<span class="indent">
BalancerMember http://1.2.3.4:8009<br />
<td>Balancer sticky session name. The value is usually set to something
like <code>JSESSIONID</code> or <code>PHPSESSIONID</code>,
and it depends on the backend application server that support sessions.
+ If the backend application server uses different name for cookies
+ and url encoded id (like servlet containers) use | to to separate them.
+ The first part is for the cookie the second for the path.
</td></tr>
<tr><td>timeout</td>
<td>0</td>
<p>A sample balancer setup</p>
<example>
ProxyPass /special-area http://special.example.com/ smax=5 max=10<br />
- ProxyPass / balancer://mycluster/ stickysession=jsessionid nofailover=On<br />
+ ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid nofailover=On<br />
<Proxy balancer://mycluster><br />
<indent>
BalancerMember http://1.2.3.4:8009<br />
int ival;
if (!strcasecmp(key, "stickysession")) {
+ char *path;
/* Balancer sticky session name.
* Set to something like JSESSIONID or
* PHPSESSIONID, etc..,
*/
- balancer->sticky = apr_pstrdup(p, val);
+ balancer->sticky = balancer->sticky_path = apr_pstrdup(p, val);
+ if ((path = strchr(balancer->sticky, '|'))) {
+ *path++ = '\0';
+ balancer->sticky_path = path;
+ }
}
else if (!strcasecmp(key, "nofailover")) {
/* If set to 'on' the session will break
apr_thread_mutex_t *mutex; /* Thread lock for updating lb params */
#endif
void *context; /* general purpose storage */
+ const char *sticky_path; /* URL sticky session identifier */
};
struct proxy_balancer_method {
if (!balancer->sticky)
return NULL;
/* Try to find the sticky route inside url */
- *route = get_path_param(r->pool, *url, balancer->sticky);
- if (!*route)
+ *route = get_path_param(r->pool, *url, balancer->sticky_path);
+ if (*route) {
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+ "proxy: BALANCER: Found value %s for "
+ "stickysession %s", *route, balancer->sticky_path);
+ }
+ else {
*route = get_cookie_param(r, balancer->sticky);
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "proxy: BALANCER: Found value %s for "
- "stickysession %s", *route, balancer->sticky);
+ if (*route)
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+ "proxy: BALANCER: Found value %s for "
+ "stickysession %s", *route, balancer->sticky);
+ }
/*
* If we found a value for sticksession, find the first '.' within.
* Everything after '.' (if present) is our route.