I am using HAProxy for load balancing a couple of web servers (HTTP mode). The web servers are strictly dynamic, ie, there isnt any static content, only web services.
The URLs of the type (analogous)
http://192.168.5.10:8080/small
http://192.168.5.10:8080/medium
http://192.168.5.10:8080/large
Now, when i configure HAProxy to forward the incoming requests to these 3 urls on couple of machines, I'm specifying the url_path using acl
and path_end
/path_beg
, but upon placing the request I get Not Found on Accelerator
error, which is making it harder to pin point the problem.
Below is the configuration that I'm using. Also, it is not logging any errors.
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
user haproxy
group haproxy
daemon
defaults
log global
mode http
option httplog
option dontlognull
retries 3
option redispatch
maxconn 2000
contimeout 5000
clitimeout 10000
srvtimeout 10000
frontend http_proxy
bind 192.168.5.9:8888
acl is_small path_end -i small
acl is_medium path_end -i medium
acl is_large path_end -i large
use_backend web_server_small if is_small
use_backend web_server_medium if is_medium
use_backend web_server_large if is_large
backend web_server_small
mode http
balance roundrobin
option httpclose
server web_1 192.168.5.10:8080 check
server web_2 192.168.5.11:8080 check
backend web_server_medium
mode http
balance roundrobin
option httpclose
server web_1 192.168.5.12:8080 check
server web_2 192.168.5.13:8080 check
backend web_server_large
mode http
balance roundrobin
option httpclose
server web_1 192.168.5.14:8080 check
server web_2 192.168.5.15:8080 check
Is it possible to send the request from HAProxy to the web_server with the url_path?.
If HAProxy receives it as http://192.168.5.2:80/small
, then send the request to the webserver as http://192.168.5.10:8080/small
Best Answer
As your path is contained to the start of the URL why not use path_beg, the recommended use for path_end is for file name extensions.