title: HAProxy - Add Trailing Slash
body: <p>I am working on a project where I need requests destined to a particular page to be routed to a separate backend.</p>
  
  <p>For example, all requests for <a href="https://mycooldomain.com" rel="nofollow noreferrer">https://mycooldomain.com</a> will go to backend "A". But, if navigating to <a href="https://mycooldomain.com/secretpage" rel="nofollow noreferrer">https://mycooldomain.com/secretpage</a> I want it to go to backend "B".</p>
  
  <p>Now, I have this working but running into an issue where I need the trailing slash for this to work correctly.</p>
  
  <p>So, I need a way to say if request is <a href="https://[whateverhostnameisused]/secretpage" rel="nofollow noreferrer">https://[whateverhostnameisused]/secretpage</a> redirect to <a href="https://[whateverhostnameisused]/secretpage/" rel="nofollow noreferrer">https://[whateverhostnameisused]/secretpage/</a>.</p>
  
  <p>Here is a sample of my config so far:</p>
  
  <pre><code>frontend f_https
      bind *:443 ssl crt cert.pem
      reqadd X-Forwarded-Proto:\ https
  
      #define hosts
      acl host_a hdr(host) -i a.mycooldomain.com
      acl host_b hdr(host) -i b.mycooldomain.com
      acl host_c hdr(host) -i c.mycooldomain.com
  
      #custom acls
      acl secret path_beg -i /secretpage
  
      #Custom redirects
  
      ##define backend
      use_backend b_secret if secret
      use_backend b_a if host_a
      use_backend b_b if host_b
      use_backend b_c if host_c
  
      default_backend b_https
  
  backend b_secret
      server secret 192.168.15.15:5575 check
  </code></pre>