# Help for an HAProxy Newbie

**URL:** <https://discourse.haproxy.org/t/help-for-an-haproxy-newbie/4719>\
**Category:** Help!\
**Created:** [January 13, 2020, 5:26pm UTC](https://discourse.haproxy.org/t/help-for-an-haproxy-newbie/4719 "2020-01-13T17:26:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![AbunaE](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@AbunaE](https://discourse.haproxy.org/u/AbunaE)\
**Post date:** [January 13, 2020, 5:26pm UTC](https://discourse.haproxy.org/t/help-for-an-haproxy-newbie/4719/1 "2020-01-13T17:26:36Z")

</div>

Hi,

Can someone help me with my configuration ?

When i go to [https://server.domain.com/test](https://server.domain.com/test) (frontend), i need to access a private server at [http://privateserver:87/URL/SubURL/](http://privateserver:87/URL/SubURL/) (backend)

Does a http-request set-path /URL/SubURL/ in the backend section is enough ?

Thank you.

---

<div class="post-metadata">

**Author:** ![senattcs](https://avatars.discourse-cdn.com/v4/letter/s/3bc359/32.png) [@senattcs](https://discourse.haproxy.org/u/senattcs)\
**Post date:** [January 13, 2020, 6:16pm UTC](https://discourse.haproxy.org/t/help-for-an-haproxy-newbie/4719/2 "2020-01-13T18:16:23Z")

</div>

> [@AbunaE](#):
>
> privateserver:87/URL/SubURL/

May be following config might help you:

listen http\_frontend  
bind \*:443 ssl crt /path\_to\_your\_pem/your.pem  
mode http

```
acl acl_privateserver path_end -i /test
use_backend privateserver if acl_privateserver

backend privateserver
mode http
    http-request set-uri /URL/SubURL/
server privateserver privateserver:87 check resolvers dns

```

---

<div class="post-metadata">

**Author:** ![AbunaE](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@AbunaE](https://discourse.haproxy.org/u/AbunaE)\
**Post date:** [January 14, 2020, 10:48am UTC](https://discourse.haproxy.org/t/help-for-an-haproxy-newbie/4719/3 "2020-01-14T10:48:58Z")

</div>

Thank you.

I have tried this but it does not work :

503 Service Unavailable  
No server is available to handle this request.

In the log i can see :

ft\_pop\_simu~ bk\_pop\_simu/dv06 0/0/1/5/6 302 395 - - ---- 2/1/0/0/0 0/0 “GET /test/ HTTP/1.1”  
ft\_pop\_simu~ ft\_pop\_simu/ -1/-1/-1/-1/0 503 221 - - SC-- 2/1/0/0/0 0/0 “GET /Account/Login?ReturnUrl=%2fEspacePro%2fEntraineur%2fRetourPopIPN HTTP/1.1”

---

<div class="post-metadata">

**Author:** ![AbunaE](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@AbunaE](https://discourse.haproxy.org/u/AbunaE)\
**Post date:** [January 14, 2020, 10:52am UTC](https://discourse.haproxy.org/t/help-for-an-haproxy-newbie/4719/4 "2020-01-14T10:52:29Z")

</div>

\< NOSRV \> is missing in the previous message

---

<div class="post-metadata">

**Author:** ![senattcs](https://avatars.discourse-cdn.com/v4/letter/s/3bc359/32.png) [@senattcs](https://discourse.haproxy.org/u/senattcs)\
**Post date:** [January 14, 2020, 6:07pm UTC](https://discourse.haproxy.org/t/help-for-an-haproxy-newbie/4719/5 "2020-01-14T18:07:33Z")

</div>

Please share your config

---

<div class="post-metadata">

**Author:** ![AbunaE](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@AbunaE](https://discourse.haproxy.org/u/AbunaE)\
**Post date:** [January 15, 2020, 8:36am UTC](https://discourse.haproxy.org/t/help-for-an-haproxy-newbie/4719/6 "2020-01-15T08:36:12Z")

</div>

global  
log /dev/log local0  
log /dev/log local1 notice  
chroot /var/lib/haproxy  
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners  
stats timeout 30s  
user haproxy  
group haproxy  
daemon

```
    # Default SSL material locations
    ca-base /etc/ssl/certs
    crt-base /etc/ssl/private

    # See: https://ssl-config.mozilla.org/#server=haproxy&server-version=2.0.3&config=intermediate
    ssl-default-bind-ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE$
    ssl-default-bind-ciphersuites TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256
    ssl-default-bind-options no-sslv3 no-tlsv10 no-tlsv11 no-tls-tickets

```

defaults  
log global  
mode http  
option httplog  
option dontlognull  
timeout connect 5000  
timeout client 50000  
timeout server 50000  
errorfile 400 /etc/haproxy/errors/400.http  
errorfile 403 /etc/haproxy/errors/403.http  
errorfile 408 /etc/haproxy/errors/408.http  
errorfile 500 /etc/haproxy/errors/500.http  
errorfile 502 /etc/haproxy/errors/502.http  
errorfile 503 /etc/haproxy/errors/503.http  
errorfile 504 /etc/haproxy/errors/504.http

frontend ft\_box\_simu  
bind \*:443 ssl crt /etc/ssl/certs/wildcard.domain.com.pem  
acl box\_url path\_end -i /testboxbd  
acl box\_url2 path\_beg -i /account/  
use\_backend bk\_box\_simu if box\_url  
use\_backend bk\_box\_simu2 if box\_url2

backend bk\_box\_simu  
http-request set-path /EspacePro/Entraineur/RetourPayboxIPN  
server dv06 dv06.local:9080 check

backend bk\_box\_simu2  
server dv06 dv06.local:9080 check

I don’t know how to deal with the returned backend url. I have created a second acl and i can go further but some backend url are still not managed : /Scripts/… and the page is not fully loaded

Should i add an acl for each different URL the backend return ?

Is it possible to hide the backend URL in the client browser and keep displayed /testboxbd ?

Thank you

---

<div class="post-metadata">

**Author:** ![senattcs](https://avatars.discourse-cdn.com/v4/letter/s/3bc359/32.png) [@senattcs](https://discourse.haproxy.org/u/senattcs)\
**Post date:** [January 17, 2020, 5:48am UTC](https://discourse.haproxy.org/t/help-for-an-haproxy-newbie/4719/7 "2020-01-17T05:48:17Z")

</div>

@lukastribus - I will let you take a look into this issue

---

<div class="post-metadata">

**Author:** ![AbunaE](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@AbunaE](https://discourse.haproxy.org/u/AbunaE)\
**Post date:** [January 20, 2020, 2:04pm UTC](https://discourse.haproxy.org/t/help-for-an-haproxy-newbie/4719/8 "2020-01-20T14:04:32Z")

</div>

Actually, i want my backend application to be accessed through the HAProxy with the /testboxhd. Always.

The problem is in the responses which delete the /testboxhd then my acl doesn’t work. If i set a default\_backend it works but i need to force the /testpayboxhd

So i have started to play with the http-response and reqirep to mody queries and responses but i’m not sure of what i did :

frontend ft\_box\_simu  
bind \*:443 ssl crt /etc/ssl/certs/wildcard.domain.com.pem  
acl box\_url path\_end -i /testboxhd  
acl box\_url2 path\_beg -i /testboxhd/  
use\_backend bk\_box\_simu if box\_url  
use\_backend bk\_box\_simu2 if box\_url2

backend bk\_box\_simu  
http-request set-path /EspacePro/Entraineur/RetourBoxIPN  
server dv06 dv06.local:56 check  
http-response replace-header Location (.\*) testboxhd\1

backend bk\_box\_simu2  
reqirep ^([^\]_)\ /testboxhd/(._) \1\ /\2  
server dv06 dv06.local:56 check  
http-response replace-header Location (.\*) testboxhd\1

It almost works but i still have some content which tries to reach the backend server without the /testboxhd and i can’t find out why.

Is there an expert or someone who knows very well haproxy to validate my conf or tell me if there is an easier way to achieve that ?

Thank you

---

<div class="post-metadata">

**Author:** ![AbunaE](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@AbunaE](https://discourse.haproxy.org/u/AbunaE)\
**Post date:** [January 20, 2020, 3:58pm UTC](https://discourse.haproxy.org/t/help-for-an-haproxy-newbie/4719/9 "2020-01-20T15:58:03Z")

</div>

Problem is with the page content and its path not updated with the /testboxhd subdirectory.
