• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
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 Mar 26, 2020, 8:56 PM

    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 Mar 26, 2020, 9:31 PM Reply Quote 0
    • P
      PiBa @alexmanny
      last edited by PiBa Mar 26, 2020, 9:32 PM Mar 26, 2020, 9:31 PM

      @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 Mar 26, 2020, 9:34 PM

        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 Mar 27, 2020, 12:11 AM Reply Quote 0
        • P
          PiBa @alexmanny
          last edited by Mar 27, 2020, 12:11 AM

          @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 Mar 27, 2020, 12:47 AM

            Gotcha, thank you.

            1 Reply Last reply Reply Quote 0
            5 out of 5
            • First post
              5/5
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
              This community forum collects and processes your personal information.
              consent.not_received