<div dir="ltr">Hello,<br><br>I am configuring an environment where at deployment-time static files are identified and stored in a known location. Also as part of deployment, each static file has a compressed version generated, and touch'ed with the same times as the source file (e.g. touch --reference=foo.js foo.js.gz).<br>
<br>The one interesting requirement that did not seem straight-forward is that I want to pass the URL to the back-end if the static file could not be found (instead of returning a 404). This should be a rare occurrence and can be tracked through the nginx logs.<br>
<br>What I have looks like:<br><br>location / {<br> # ... various proxy settings<br>
<br> proxy_pass <a href="http://zope-consumer/" target="_blank">http://back-end</a>;<br>
} <br><br>location ^~ /static/ {<br> alias /opt/nginx/assets/static/;<br><br> expires max;<br> gzip_static on;<br><br> error_page 404 = /|dynamic|$uri;<br>}<br> <br>
location ^~ /|dynamic|/ {<br> internal;<br> rewrite ^/[|]dynamic[|](.*) $1;<br><br> # ... various proxy settings<br><br> proxy_pass <a href="http://zope-consumer" target="_blank">http://back-end</a>;<br>
}<br><br clear="all">Is there a cleaner way to do this?<br><br>Thanks,<br><br>-- <br>Adam<br><a href="mailto:zellster@gmail.com" target="_blank">zellster@gmail.com</a><br>
</div>