Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4731

How to balance w/ consistent-hash based on only the filename?

$
0
0

@sottolski wrote:

Hi,

it's probably dead simple, but I can't figure it out. I have request URLs in a form of

http://hostname.tld/some/subdir/filename.suffix
http://hostname.tld/other/subdir/filename.suffix

The "/some/subdir/" and "/other/subdir/" are more or less random; only the "filename.suffix" is consistent.

Consequently, I can't use the beginning of the path for balancing with "hash-type consistent", but need to balance based only on the filename portion of the URL. Is there something like a negative value for the "depth" parameter (depth -1)? Otherwise, I could probably extract the filename.suffix portion by a regex, add the result as a header, and use that header for the balancing.

frontend
http-request set-header "X-Filename"

backend
hash-type consistent
balance hdr("X-Filename")

In addition, I only want the filename.suffix taken in to account for the consistent hashing, nothing else, especially NOT the Host header.

So basically the question is, how do I add the header with the filename?

Thanks in advance

Sascha

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4731

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>