Skip to content

Instantly share code, notes, and snippets.

@jerrinot
Created January 22, 2014 18:07
Show Gist options
  • Save jerrinot/8564004 to your computer and use it in GitHub Desktop.
Save jerrinot/8564004 to your computer and use it in GitHub Desktop.
mod_proxy_balancer.c snippet
if ((*route) && ((*route = strchr(*route, '.')) != NULL ))
(*route)++;
if ((*route) && (**route)) {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy: BALANCER: Found route %s", *route);
/* We have a route in path or in cookie
* Find the worker that has this route defined.
*/
worker = find_route_worker(balancer, *route, r);
if (worker && strcmp(*route, worker->s->route)) {
/*
* Notice that the route of the worker chosen is different from
* the route supplied by the client.
*/
apr_table_setn(r->subprocess_env, "BALANCER_ROUTE_CHANGED", "1");
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy: BALANCER: Route changed from %s to %s",
*route, worker->s->route);
}
return worker;
}
else
return NULL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment