Using URL in HAProxy Backend instead of IP address
-
Hi, I'm new to HAProxy, however I got it configured and working but I currently have my frontend set to subdomain.mydomain.com and it goes to my backend local ipaddress:port.
However I was wondering if I can somehow add a specific page to my backend ip address, so for example my backend would be 192.168.10.100:1000/specific_page.html
Or if its even possible to set a URL in the backend instead of an IP address.
Thanks.
-
@alexmanny
Servers are defined by IP addresses or FQDN's / DNS names. A 'url' cannot be used to define a server. (or a pfSense 'alias')If you want to direct users to a specific url / page it is possible to send a redirect, or overwrite the requested path with 'actions'.. probably need a custom action and some carefull study of 'http://cbonte.github.io/haproxy-dconv/1.9/snapshot/configuration.html#http-request%20set-path'
-
Thanks, but can I have two redirects on the same ip? What I mean is, I already have a frontend redirect in HAProxy to redirect all http to http(s), is it possible to add another redirect to a specific page like you suggested? while still having the first redirect to http(s)? or do I have to merge the two into one redirect?
-
@alexmanny
You can have lots of different redirects, but only 1 will be send to a client at a time.. So use acl's to perform the desired redirect when it is applicable.Something like (pseudo code..):
redirect scheme https if http redirect location /specific_page.html if path /
-
Gotcha, thank you.