this is a great solution!<br>thanks so much!<br><br><div class="gmail_quote">On Thu, Jan 19, 2012 at 12:22 PM, António P. P. Almeida <span dir="ltr"><<a href="mailto:appa@perusio.net">appa@perusio.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 19 Jan 2012 14h44 WET, <a href="mailto:ionathan@gmail.com">ionathan@gmail.com</a> wrote:<br>
<br>
> Hi all! I want to proxy_pass depending on the value of the accept<br>
> header. I have lots of locations and I wanted to add in a single<br>
> place a validation that if accept header is 'text/html" it should<br>
> proxy_pass to some specific upstream. Else, just go ahead and try to<br>
> match a location.<br>
<br>
> Is that possible?<br>
<br>
</div></div>Perhaps something like:<br>
<br>
# http level<br>
<br>
map $http_accept $my_upstream {<br>
default misc_upstream;<br>
~text/html html_upstream;<br>
<br>
}<br>
<br>
upstream misc_upstream {<br>
server <a href="http://127.0.0.1:8080" target="_blank">127.0.0.1:8080</a>;<br>
}<br>
<br>
upstream html_upstream {<br>
server <a href="http://127.0.0.1:8088" target="_blank">127.0.0.1:8088</a>;<br>
}<br>
<br>
# server level<br>
<br>
location / {<br>
#... your stuff<br>
proxy_pass http://$my_upstream;<br>
}<br>
<br>
--- appa<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div><br>