Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4718

Forwarding to a backend on a new URL path

$
0
0

@GoodmanDev wrote:

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

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4718

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>