0

I'm looking for a reverse proxy solution which either:

a) Let's me explicitly define which requests go to which servers based on a regex (or some other similar way of defining that certain URL patterns get mapped to certain back-end servers)

OR

b) Supports some sort of hash algorithm for proxying so that requests for a given URL always get mapped to one specific server, and publishes that algorithm so that I can use it in my application to determine which server a given URL will be mapped to.

Anything out there like this? Or do I have to write my own...?

Keith Palmer Jr.
  • 1,151
  • 4
  • 16
  • 28

2 Answers2

2

As far as full-on web servers with proxy capabilities go, both Apache and nginx would both be capable of satisfying option a.

In Apache, you would want to use mod_rewrite's proxy capability:

RewriteRule /(location[1-5]*\.html)$ http://sourceserver.example.com/$1 [P]

In nginx, you'd just use a regex for your location directive - see here

For option B, most proxies that implement a hashing option use the opposite approach; making sure that all the requests from a given client are sent to the same server to maintain session state. Can you go into a little more detail about why that would be desirable?

Shane Madden
  • 112,982
  • 12
  • 174
  • 248
0

Pretty sure you can do this with haproxy too, see http://code.google.com/p/haproxy-docs/wiki/MatchingLayer7

The previous serverfault question: choose server backend to some URL with haproxy has an example.

Whether or not this is sensible, I don't know. Probably isn't looking at the other answer and the warning in haproxy's documentation.

Pricey
  • 419
  • 1
  • 5
  • 19