title: How do I rewrite URLs in a proxy response in NGINX
body: <p>I'm used to using Apache with mod_proxy_html, and am trying to achieve something similar with NGINX.  The specific use case is that I have an admin UI running in Tomcat on port 8080 on a server at the root context:</p>
  
  <pre><code>http://localhost:8080/
  </code></pre>
  
  <p>I need to surface this on port 80, but I have other contexts on the NGINX server running on this host, so want to try and access this at:</p>
  
  <pre><code>http://localhost:80/admin/
  </code></pre>
  
  <p>I was hoping that the following super simple server block would do it, but it doesn't quite:</p>
  
  <pre><code>server {
      listen  80;
      server_name screenly.local.akana.com;
  
      location /admin/ {
          proxy_pass http://localhost:8080/;
      }
  }
  </code></pre>
  
  <p>The problem is that the returned content (html) contains URLs to scripts and style info that is all accessed at the root context, so I need to get these URLs rewritten to start with /admin/ instead of /.</p>
  
  <p>How do I do this in NGINX?</p>