Hello!
I currently host a multi-server application using Apache HTTPD as a proxy, and am in the process of moving across to HAProxy. I’ve found a lot of the configuration far simpler and more intuitive than Apache, but am stumped on one particular requirement (enforced by the application).
Requests come in to HAProxy on a path matching /ApplicationA/rest/of/path, /ApplicationB/rest/of/path, /ApplicationC/rest/of/path, and based on the application letter (A, B, C) HAProxy is to pass the request onto one of a number of backend servers. The caveat is that the request needs to be forwarded to the backend on /Application/rest/of/path, rather than /Application/rest/of/path.
I’ve tried the something along these lines, but since the reqrep is applied before use backend, I end up with the request URL failing to match.
acl url_application_a path_beg /ApplicationA
acl url_application_b path_beg /ApplicationB
acl url_application_a path_beg /ApplicationC
use_backend APP_A if url_application_a
use_backend APP_B if url_application_b
use_backend APP_C if url_application_c
reqrep ^([^\ :]*)\ /ApplicationA[/]?(.*) \1\ /Application/\2 if url_application_a
reqrep ^([^\ :]*)\ /ApplicationB[/]?(.*) \1\ /Application/\2 if url_application_b
reqrep ^([^\ :]*)\ /ApplicationC[/]?(.*) \1\ /Application/\2 if url_application_c
Is what I’m looking for possible? And am I just missing something silly? Any help would be greatly appreciated!
Thanks in advance