3

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/(.*) http://mycdn.com/$1;
}

Is it possible to do the same thing with haproxy?

1 Answer 1

2

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

frontend http_proxy
  bind 0.0.0.0:80
  acl is_cnd path_beg /static/pdfs/
  use_backend cdn if is_cdn
  default_backend mysite

backend cdn
  server mycdn.com

backend mysite
  server regular-site.com

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

2
  • It is pretty close. In fact, it is correct ;) Nov 20, 2010 at 3:16
  • 3
    No, it is not correct, because it leaves /static/pdfs prefix, which he wants to be removed. I need the same thing :D Apr 19, 2012 at 13:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .