Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to proxy all requests to /static/pdfs to a cdn that has the same filenames but doesn't have the /static/pdfs prefix. I can do this easily with nginx like this:

location ^~ /static/pdfs/ {
  rewrite /static/pdfs/(.*)$1;

Is it possible to do the same thing with haproxy?

share|improve this question

You will have to use a frontend /backend configuration. For example:

frontend http_proxy
  acl is_cnd path_beg /static/pdfs/
  use_backend cdn if is_cdn
  default_backend mysite

backend cdn

backend mysite

I'm doing this from memory so it might not be exactly right, but if not then it's pretty close.

share|improve this answer
It is pretty close. In fact, it is correct ;) – Leandro López Nov 20 '10 at 3:16
No, it is not correct, because it leaves /static/pdfs prefix, which he wants to be removed. I need the same thing :D – Dalibor Filus Apr 19 '12 at 13:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.