title: HAProxy - request path rewriting always to /
body: <p>I have configuration for HAProxy which translate from 
  <a href="https://sub-domain.domain.com/file.html" rel="nofollow noreferrer">https://sub-domain.domain.com/file.html</a> to 
  <a href="https://s3.server.com/sub-domain.domain.com/file.html" rel="nofollow noreferrer">https://s3.server.com/sub-domain.domain.com/file.html</a></p>
  
  <p>It works, but I need to change it to translate form</p>
  
  <p><a href="https://sub-domain.domain.com/file.html" rel="nofollow noreferrer">https://sub-domain.domain.com/file.html</a> to 
  <a href="https://s3.server.com/sub-domain.domain.com/" rel="nofollow noreferrer">https://s3.server.com/sub-domain.domain.com/</a></p>
  
  <p>It should ignore path, and always redirect to /</p>
  
  <p>I tried to change:
  http-request set-path /%[req.hdr(host),lower]%[path]
  to
  http-request set-path /%[req.hdr(host),lower]</p>
  
  <p>But it makes my browser redirect from
  <a href="https://sub-domain.domain.com/" rel="nofollow noreferrer">https://sub-domain.domain.com/</a>
  to
  <a href="https://sub-domain.domain.com/sub-domain.domain.com/" rel="nofollow noreferrer">https://sub-domain.domain.com/sub-domain.domain.com/</a></p>
  
  <p>This is my full configuration:</p>
  
  <pre><code>global
      daemon
      maxconn 200000
  
  defaults
      mode http
      timeout connect 5000ms
      timeout client 50000ms
      timeout server 50000ms
  
  frontend http-in
      bind *:80
      bind *:443
      default_backend servers
  
  backend servers
      http-request set-path /%[req.hdr(host),lower]%[path]
      http-request set-header Host myserver.s3.com
      server server1 myserver.amazonaws.com maxconn 200000
  </code></pre>
  
  <p>Thank you in advance for any help.</p>