Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Using URL in HAProxy Backend instead of IP address

    Scheduled Pinned Locked Moved Cache/Proxy
    5 Posts 2 Posters 2.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      alexmanny
      last edited by

      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.

      P 1 Reply Last reply Reply Quote 0
      • P
        PiBa @alexmanny
        last edited by PiBa

        @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'

        1 Reply Last reply Reply Quote 0
        • A
          alexmanny
          last edited by

          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?

          P 1 Reply Last reply Reply Quote 0
          • P
            PiBa @alexmanny
            last edited by

            @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 /
            
            1 Reply Last reply Reply Quote 0
            • A
              alexmanny
              last edited by

              Gotcha, thank you.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.