proxy only certain assets based on host header?

António P. P. Almeida appa at perusio.net
Fri May 24 08:45:02 UTC 2013


location ~ ^/(?:stylesheets|images|javascripts|tools|flash|components)/ {
     error_page 418 = @proxied_assets;

     if ($http_host = dnsname.com) {
         return 418;
     }

    # add other directives here if need be...
}

location @proxied-assets {
    proxy_pass http://assethost;
}


----appa



On Fri, May 24, 2013 at 3:07 AM, amagad <nginx-forum at nginx.us> wrote:

> 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 = dnsname.com) {
>   location ~ ^/(stylesheets|images|javascripts|tools|flash|components)/ {
>     proxy_pass http://assethost
>   }
> }
>
> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?2,239494,239494#msg-239494
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20130524/de9db06e/attachment.html>


More information about the nginx mailing list