JPump
JPump

Reputation: 41

HAProxy routing, without hard path

I want to catch and route a call based on URL/admin, but the backend doesn't respond to /admin, rather at /. How can I do this? Below will send the call to someaddress.com:80/admin when I need it to ignore the admin and go to someaddress.com:80

acl url_admintool_ui path_beg /admin
use_backend admintool-ui-backend if url_admintool_ui

backend admintool-ui-backend
mode http
server admintool-ui someaddress.com:80

Upvotes: 1

Views: 390

Answers (1)

Mo3m3n
Mo3m3n

Reputation: 609

The reqrep keyword should do the job.

reqrep ^([^\ :]*)\ /admin(.*)     \1\ /\2 if url_admintool_ui

Upvotes: 1

Related Questions