proxy only certain assets based on host header?

amagad nginx-forum at
Fri May 24 01:07:21 UTC 2013

We're trying to proxy only certain assets like png|jpg|css only when the
host header is a certain DNS name. I tried to do this in the proxy.conf file
using something the example below but it doesnt like the if statement. Is
there a way to have nginx do what I am looking for?

if ($http_host = {
  location ~ ^/(stylesheets|images|javascripts|tools|flash|components)/ {
    proxy_pass http://assethost

Posted at Nginx Forum:,239494,239494#msg-239494

More information about the nginx mailing list