Maybe this is the problem? Line 548 of backend.c from 1.4.11:
if (s->txn.meth == HTTP_METH_POST &&
memchr(s->txn.req.sol + s->txn.req.sl.rq.u,
'&',
s->txn.req.sl.rq.u_l ) == NULL)
s->srv = get_server_ph_post(s);
else
s->srv = get_server_ph(s->be,
s->txn.req.sol +
s->txn.req.sl.rq.u,
s->txn.req.sl.rq.u_l);
It looks to me like when the method is a POST, that the url is
searched for a '&' character and if it's not found then the post body
might be checked. Of course, it's quite likely that there is just one
query string parameter so the uri would not contain a '&'. I believe
this should check for the existence of a '?' instead.
If this is the case, then I think there is a documentation bug as well
since the first line for url_param claims it only works for GET.
-Bryan
On Fri, Feb 25, 2011 at 12:46 PM, Bryan Talbot <[email protected]> wrote:
> In general, I need to load balance based on a url param for any
> standard HTTP method, especially the RESTful ones, not just GET. I
> need it to work for GET, HEAD, PUT, DELETE, POST at the very least. It
> would be great to work with custom methods like PURGE as well as that
> is commonly used with proxy-caches.
>
> Why limit balance url_param to only work with GET? Why not allow it
> to work with any method that contains a URI?
>
> -Bryan
>
>
>
> On Thu, Feb 24, 2011 at 11:12 AM, Bryan Talbot <[email protected]> wrote:
>> I'm not sure I understand how the url_param option for balance is
>> supposed to work. From reading the description, it sounded like it
>> might work for both GET and POST methods when either method includes a
>> query string section in the URI. However, that doesn't seem to be
>> working as I expected with 1.4.10.
>>
>> listen foo
>> bind: *.80
>> balance url_param id
>> server one a.b.c.d ...
>> server two a.b.c.e ...
>>
>>
>> GET /foo/bar?id=1 --> works fine and always sends traffic to the same
>> server
>> POST /foo/bar?id=1 --> uses round robin
>>
>>
>> The docs say:
>>
>> url_param The URL parameter specified in argument will be looked up in
>> the query string of each HTTP GET request.
>>
>> If the modifier "check_post" is used, then an HTTP POST
>> request entity will be searched for the parameter argument,
>> when the question mark indicating a query string ('?') is
>> not
>> present in the URL. ...
>>
>>
>> which confuses me on whether or not POST query string params are
>> searched or not. The first statement says it only works with GET
>> methods. The second section says it can work with POST entity content
>> only when a query string is not present.
>>
>> I would like to use url_param balancing for POST query string
>> parameters. How can I do that?
>>
>> -Bryan
>>
>