Hi Mark,

Le 09/02/2017 à 18:16, Mark Staudinger a écrit :
Hi Daniel,

I provided a stripped-down backend configuration.

I am in fact using a persistence cookie, but not for all requests, so I
would prefer to avoid that as a means of identifying the particular
backend vs. sticking to a particular backend server - especially as the
cookie does need to make it to the client when it's set.

You can have a look at the Custom Log Format chapter : http://cbonte.github.io/haproxy-dconv/1.7/configuration.html#8.2.4

Then use :
  http-response set-header X-Server %s


Cheers,
-=Mark

On Thu, 09 Feb 2017 11:59:47 -0500, Daniel Schneller
<daniel.schnel...@centerdevice.com> wrote:

    Hi!

    I know this is not exactly what you want, but as your example does
    not show a persistence cookie, you could use that.
    See https://cbonte.github.io/haproxy-dconv/1.7/configuration.html#4.2-cookie
    You could also delete it from the request in the frontend on the way
    in to prevent the request from actually sticking to a single server.

    Daniel

    --
    Daniel Schneller
    Principal Cloud Engineer

    CenterDevice GmbH                  | Hochstraße 11
                                       | 42697 Solingen
    tel: +49 1754155711                | Deutschland
    daniel.schnel...@centerdevice.de
    <mailto:daniel.schnel...@centerdevice.de>   | www.centerdevice.de
    <http://www.centerdevice.de>

    Geschäftsführung: Dr. Patrick Peschlow, Dr. Lukas Pustina,
    Michael Rosbach, Handelsregister-Nr.: HRB 18655,
    HR-Gericht: Bonn, USt-IdNr.: DE-815299431


    On 9. Feb. 2017, at 17:32, Mark Staudinger
    <mark.staudin...@nyi.net <mailto:mark.staudin...@nyi.net>> wrote:

    Hi Folks,

    Given a setup where I have a backend like so:

    backend production
           balance roundrobin
           hash-type consistent
           http-check expect status 200
           option httpchk GET /\ HTTP/1.1\r\nHost:\ myhost.net
    <http://myhost.net>\r\nUser-agent:\ healthcheck\r\nConnection:\ close
    server prod_1192.168.1.10:80 weight 50 maxconn 150 check inter 1m
    server prod_2192.168.1.20:80 weight 50 maxconn 150 check inter 1m
    server prod_3192.168.1.30:80 weight 50 maxconn 150 check inter 1m

    I'd like to report which of the servers handled this particular
    request, by way of HTTP response header.  For a variety of
    reasons, this isn't best done by the backend servers themselves.

    I was eager to try this:

    http-send-name-header Origin-Server

    but it appears this sends the name to the backend as a request
    header.  Is there a similar feature that will do this with a
    response header, or some combination of http-response set-header
    that will perform the equivalent?  I'm looking to return (to the
    frontend and then on the client) something like

    Origin-Server: prod_2

    Best Regards,
    Mark Staudinger







--
Cyril Bonté

Reply via email to