Hi all Recently I needed to substitute http headers in requests such as the following:
From Referer: https://a-b-c.example.com/x-caliber To Referer: https://a.b.c.example.com/x-caliber Basically any hyphen in the subdomain part of example.com needed to be replaced by dots, but any other hyphens should not be replaced. I tried doing it with regsub() but the limitation on the accepted characters (no parenthesis or square brackets) limits the possible regular expressions that can be used. Also “http-request replace-header” is limited because it does not handle multiple matches – if there is more than one match there is no way of back-referencing to all matches (so varying number of matches cannot be handled). What I needed was a cross between replace-header and regsub. So I am suggesting the substitute-header and substitute value actions for http requests and responses. I have a reference implementation for this on my github branch here: https://github.com/darcoli/haproxy/tree/substitute-header-value. I am also attaching a patch with my changes with this email. I have done some testing and am confident the basic functionality works. But please review and I will be happy to handle any suggestions or fixes that you may have. Best regards Darren Demicoli [https://s3-eu-west-1.amazonaws.com/xcaliber-signature/X.png] Darren Demicoli Devops Engineer Mobile: (+356) 796 853 46 | Skype: darren.demicoli Address: MT: Spinola Park, 7th Floor, Triq Mikiel Ang Borg, SPK1000. St. Julians, Malta PL: ul. Sobieskiego 2, 40-082 Katowice, Poland [https://s3-eu-west-1.amazonaws.com/xcaliber-signature/1-XC_Logo.png]<https://xcaliber.com/> [http://cdn2.hubspot.net/hubfs/184235/dev_images/signature_app/facebook_sig.png]<https://www.facebook.com/xcaliber.io/> [http://cdn2.hubspot.net/hubfs/184235/dev_images/signature_app/twitter_sig.png] <https://twitter.com/xcaliber_io> [http://cdn2.hubspot.net/hubfs/184235/dev_images/signature_app/linkedin_sig.png] <https://www.linkedin.com/company/10871401/> [https://s3-eu-west-1.amazonaws.com/xcaliber-signature/iso_cert.png] XCaliber is an ISO27001 certified company for information security management. This message (including any attachments) may contain confidential, proprietary, privileged and/or private information. The information is intended to be for the use of the individual or entity designated above. If you are not the intended recipient of this message, please notify the sender immediately, and delete the message and any attachments. Any disclosure, reproduction, distribution or other use of this message or any attachments by an individual or entity other than the intended recipient is prohibited.