<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.&nbsp; Also as part of deployment, each static file has a compressed version generated, and touch&#39;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).&nbsp; 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>&nbsp; # ... various proxy settings<br>
<br>&nbsp; proxy_pass <a href="http://zope-consumer/" target="_blank">http://back-end</a>;<br>
} <br><br>location ^~ /static/ {<br>&nbsp; alias /opt/nginx/assets/static/;<br><br>&nbsp; expires max;<br>&nbsp; gzip_static on;<br><br>&nbsp; error_page 404 = /|dynamic|$uri;<br>}<br>&nbsp; <br>
location ^~ /|dynamic|/ {<br>&nbsp; internal;<br>&nbsp; rewrite ^/[|]dynamic[|](.*) $1;<br><br>&nbsp; # ... various proxy settings<br><br>&nbsp; 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>