Urlrewrite change/manipulate url


#1

Hello everybody,

I want to set a backend rewrite url in proxy with additional parameter.
Called Url for example:

https://api.company.de/sap/getproduct/MATNR/SERNR

Internal URL called for proxy :

http://internalserver.domain.local/sap/transaction/ProductSet(MATNR='1234',SERNR='1')?$format=json

So my backend settings in haproxy.cfg:

# SAP
backend sap
        mode http
        reqrep ^([^\ :]*)\ /sap/getproduct/(.*)/(.*) \1\ /sap/transaction/ProductSet(MATNR=\'316511\',SERNR=\'1\')?$format=json\2
        server internalserver internalserver.domain.local:8080 check

Now i want to change with reqrep and the url the fields in matnr and sernr. With fixed values I get a response but not with dynamic parameter.

Thanks for help!

Kind regards

Daniel


#2

Answer is:

reqrep ^([^\ :]*)\ /sap/cc/getproduct/([0-9]+)/([0-9]+)/(.*) \1\ /sap/transaction/ProductSet(MATNR=\'\2\',SERNR=\'\3\')?$format=json\4

Thanks