1

An application on client (192.168.1.106) is trying to access a service 192.168.1.10:8080. A log entry from this request is below. I would like to configure haproxy to send that request directly to 192.168.1.10:8080 rather than using backend privoxy-back.

I'm near certain I need to add an ACL to my haproxy configuration but I'm finding the documentation far too extensive for this particular issue. Some of the StackExchange posts below come close, but they are not quite what I'm looking for.

Can you please help me understand what must be done here?

Feb  9 07:21:24 localhost.localdomain haproxy[21851]: 192.168.1.106:49326 
[09/Feb/2018:07:21:24.199] privoxy-front privoxy-back/proxy02 89/0/0/-1/91 -1 
132 - - SD-- 129/129/129/128/0 0/0 "GET http://192.168.1.10:8080/ HTTP/1.1"

frontend privoxy-front
 bind :8118
 mode http
 default_backend privoxy-back

backend privoxy-back
 mode http
 option forwardfor
 server proxy01 192.168.20.62:8118 check backup
 server proxy02 192.168.25.72:8118 check

These are the posts that I have already checked and didn't work.

1

If you want HAProxy to handle your request you need to have a frontend and backend. As far as i know you need to have a Backend and can not leave that out. Why do you not want to use a backend? I don't see how that would pose a problem for you. Anyway you could handle it like this:

  1. Configure a frontend that runs a your desired port
  2. Configure a backend that has the actual server configurated you want to proxy to
  3. Link the created frontend to the backend

So your configuration is almost correct. Given the following assumptions

  1. Clients ip is 192.168.1.106
  2. Application server ip the client is connecting to is 192.168.1.10 on port 8080
  3. Actual application server(whatever the application is you want to proxy to) ips and ports are 192.168.20.62:8118 and 192.168.25.72:8118

Your configuration should be as below and your HAProxy should run on 192.168.1.10:

frontend privoxy-front
 bind :8080
 mode http
 default_backend privoxy-back

backend privoxy-back
 mode http
 option forwardfor
 server applicationServer1 192.168.20.62:8118 check
 server applicationServer2 192.168.25.72:8118 check

I removed backup because that would mean the traffic is routed only to that server if all other servers are down.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.