For what it’s worth (and the rest of the mailing list), here’s how I’m fixing this in 1.6:
In haproxy.cfg: global lua-load uniqueid.lua frontend myfrontend http-request lua.uniqueid And uniqueid.lua: local uuid = require "uuid4" core.register_action("uniqueid", {"http-req"}, function(txn) -- Check to see if the X-UniqueId header is already there. -- If it's not there, provide a new one local unique_id_header = txn.f:hdr("X-Unique-Id") if unique_id_header == nil then local u = uuid.getUUID() txn.http:req_set_header("X-Unique-Id", u) end end) I’m using the uuid4 library from here: https://github.com/erento/LUA-RFC-4122-UUID-Generator Thanks, Scott On 4/8/16, 7:16 PM, "Thierry FOURNIER" <thierry.fourn...@arpalert.org> wrote: >It is avalaible in the development version (1.7dev). > >Thierry > > >On Fri, 8 Apr 2016 16:23:44 +0000 >Scott Rankin <sran...@motus.com> wrote: > >> Hi Thierry, >> >> Thanks for the suggestion - but the %[unique-id] variable is empty when I >> use the config below. I’m using HAProxy 1.6.4. Did you have to do anything >> else to get that to show up? >> >> >> >> Thanks! >> Scott >> >> On 4/8/16, 12:04 PM, "Thierry FOURNIER" <thierry.fourn...@arpalert.org> >> wrote: >> >> >Hi, >> > >> >I ve just submit a sample which returns the content of the unique-id. >> >So, you can write: >> > >> > unique-id-format %{+X}o\ %ci-%cp-%rt-%pid-%Ts%fp >> > acl unique_id_missing hdr_cnt(X-Unique-ID) eq 0 >> > http-request add-header X-Unique-ID %[unique-id] if unique_id_missing >> > >> >Thierry >> > >> > >> >On Fri, 8 Apr 2016 15:31:22 +0000 >> >Scott Rankin <sran...@motus.com> wrote: >> > >> >> Hi all, >> >> >> >> I’m trying to replicate functionality from a previous load balancer in >> >> HAProxy, and the final sticking point seems to be the unique ID header. >> >> I found the unique-id-header and unique-id-format commands, which are >> >> great, but what I want to do is only add a unique-id-header if there is >> >> not already one present. If there is one present, I do not want to add >> >> another one (which is what seems to be happening by default). >> >> >> >> I’ve tried adding a conditional: >> >> >> >> acl unique_id_missing hdr_cnt(X-Unique-ID) eq 0 >> >> unique-id-format %{+X}o\ %ci-%cp-%rt-%pid-%Ts%fp >> >> unique-id-header X-Unique-ID if unique_id_missing >> >> >> >> But that does not seem to be working. Should it? If not, is there >> >> another way to go about this? >> >> >> >> Thanks! >> >> Scott >> >> >> >> This email message contains information that Motus, LLC considers >> >> confidential and/or proprietary, or may later designate as confidential >> >> and proprietary. It is intended only for use of the individual or entity >> >> named above and should not be forwarded to any other persons or entities >> >> without the express consent of Motus, LLC, nor should it be used for any >> >> purpose other than in the course of any potential or actual business >> >> relationship with Motus, LLC. If the reader of this message is not the >> >> intended recipient, or the employee or agent responsible to deliver it to >> >> the intended recipient, you are hereby notified that any dissemination, >> >> distribution, or copying of this communication is strictly prohibited. If >> >> you have received this communication in error, please notify sender >> >> immediately and destroy the original message. >> >> >> >> Internal Revenue Service regulations require that certain types of >> >> written advice include a disclaimer. To the extent the preceding message >> >> contains advice relating to a Federal tax issue, unless expressly stated >> >> otherwise the advice is not intended or written to be used, and it cannot >> >> be used by the recipient or any other taxpayer, for the purpose of >> >> avoiding Federal tax penalties, and was not written to support the >> >> promotion or marketing of any transaction or matter discussed herein. >> > >> > >> >-- >> > >> This email message contains information that Motus, LLC considers >> confidential and/or proprietary, or may later designate as confidential and >> proprietary. It is intended only for use of the individual or entity named >> above and should not be forwarded to any other persons or entities without >> the express consent of Motus, LLC, nor should it be used for any purpose >> other than in the course of any potential or actual business relationship >> with Motus, LLC. If the reader of this message is not the intended >> recipient, or the employee or agent responsible to deliver it to the >> intended recipient, you are hereby notified that any dissemination, >> distribution, or copying of this communication is strictly prohibited. If >> you have received this communication in error, please notify sender >> immediately and destroy the original message. >> >> Internal Revenue Service regulations require that certain types of written >> advice include a disclaimer. To the extent the preceding message contains >> advice relating to a Federal tax issue, unless expressly stated otherwise >> the advice is not intended or written to be used, and it cannot be used by >> the recipient or any other taxpayer, for the purpose of avoiding Federal tax >> penalties, and was not written to support the promotion or marketing of any >> transaction or matter discussed herein. > > >-- > This email message contains information that Motus, LLC considers confidential and/or proprietary, or may later designate as confidential and proprietary. It is intended only for use of the individual or entity named above and should not be forwarded to any other persons or entities without the express consent of Motus, LLC, nor should it be used for any purpose other than in the course of any potential or actual business relationship with Motus, LLC. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify sender immediately and destroy the original message. Internal Revenue Service regulations require that certain types of written advice include a disclaimer. To the extent the preceding message contains advice relating to a Federal tax issue, unless expressly stated otherwise the advice is not intended or written to be used, and it cannot be used by the recipient or any other taxpayer, for the purpose of avoiding Federal tax penalties, and was not written to support the promotion or marketing of any transaction or matter discussed herein.