Thank you so much Jarno, 

the word converter did exactly what I needed. Works really well :) 

- Maya

> On 12. Aug 2021, at 08:10, Jarno Huuskonen <jarno.huusko...@uef.fi> wrote:
> 
> Hello,
> 
> On 8/12/21 8:59 AM, Maya Lena Ayleen Scheu wrote:
>> Your solution would work if I had only one static context path. The tricky 
>> thing is, that I would like to have it dynamic, so that the word between the 
>> first two “/“ always becomes the subdomain if a certain condition is true.
>> Thats where I am stuck, I don’t know how to grep that information and put it 
>> infront of my domain without being able to use the path_reg method.
> 
> Take a look at field,word and regsub:
> http://cbonte.github.io/haproxy-dconv/2.4/configuration.html#7.3.1-field
> http://cbonte.github.io/haproxy-dconv/2.4/configuration.html#7.3.1-regsub
> http://cbonte.github.io/haproxy-dconv/2.4/configuration.html#7.3.1-word
> 
> And maybe path, variables and concat with field,word.
> 
> regsub probably can modify whole url to context_path.domain.com host header.
> 
> -Jarno
> 
>> Best Regards, Maya
>>> On 12. Aug 2021, at 04:15, Igor Cicimov <ig...@encompasscorporation.com 
>>> <mailto:ig...@encompasscorporation.com>> wrote:
>>> 
>>> Hi Maya,
>>> 
>>> Maybe try this:
>>> 
>>> http-request set-header Hostcontext_path.ms.example.com 
>>> <http://context_path.ms.example.com/>if { path_beg /context_path } { 
>>> hdr(Host) -iexample.com <http://example.com/>}
>>> ------------------------------------------------------------------------
>>> *From:*Maya Lena Ayleen Scheu <maya.sc...@check24.de 
>>> <mailto:maya.sc...@check24.de>>
>>> *Sent:*Wednesday, August 11, 2021 9:58 PM
>>> *To:*haproxy@formilux.org <mailto:haproxy@formilux.org> 
>>> <haproxy@formilux.org <mailto:haproxy@formilux.org>>
>>> *Subject:*Question about available fetch-methods for http-request
>>> Hi there,
>>> 
>>> I have some questions regarding Haproxy Configuration in Version HA-Proxy 
>>> version 2.0.23, which is not clear by reading the official documentation. I 
>>> hope you would have some ideas how this could be solved.
>>> 
>>> 
>>> *What I wish to accomplish:*
>>> 
>>> A frontend application is called by an url with a context path in it.
>>> Haproxy should set a Header in the backend section with `http-request 
>>> set-header Host` whereas the set Host contains the context_path found in 
>>> the url-path. I try to make it clear with an example:
>>> 
>>> The called url looks like: `https://example.com/context_path/abc/etc 
>>> <https://example.com/context_path/abc/etc>`
>>> Out of this url I would need to set the following Host Header: 
>>> `context_path.ms.example.com <http://example.com>`, while the path remains 
>>> `/context_path/abc/etc`
>>> 
>>> While I find many fetch-examples for ACLs, I had to learn that most of them 
>>> don’t work on `http-request set-header or set-env`. I tried to use 
>>> `path_beg` or `path_reg`, which parses with errors, that the fetch method 
>>> is unknown.
>>> 
>>> So something like this doesn’t work:
>>> `http-request set-header Host %[path_reg(...)].ms.example.domain.com 
>>> <http://ms.example.domain.com/>if host_example`
>>> 
>>> or this:
>>> `http-request set-var(req.url_context) path_beg,lower if host_example`
>>> 
>>> *Question:*
>>> 
>>> I am certain that this should somehow be possible, as I found even 
>>> solutions to set variables or Headers by urlp, cookies, etc.
>>> What would be the explanation, why fetch methods like path_beg are not 
>>> available in this context? And how to work around it?
>>> 
>>> Thank you in advance and best regards,
>>> Maya Scheu
>>> *Know Your Customer due diligence on demand, powered by intelligent process 
>>> automation*
>>> Blogs <https://www.encompasscorporation.com/blog/> | LinkedIn 
>>> <https://www.linkedin.com/company/encompass-corporation/> | Twitter 
>>> <https://twitter.com/EncompassCorp>
>>> Encompass Corporation UK Ltd | Company No. SC493055 | Address: Level 3, 33 
>>> Bothwell Street, Glasgow, UK, G2 6NL
>>> Encompass Corporation Pty Ltd | ACN 140 556 896 | Address: Level 10, 117 
>>> Clarence Street, Sydney, New South Wales, 2000
>>> This email and any attachments is intended only for the use of the 
>>> individual or entity named above and may contain confidential information
>>> If you are not the intended recipient, any dissemination, distribution or 
>>> copying of this email is prohibited.
>>> If received in error, please notify us immediately by return email and 
>>> destroy the original message.
> 
> -- 
> Jarno Huuskonen

Reply via email to