title: Access swagger-ui docker instance from nginx sub-location
body: <p>I'm having trouble getting the Docker container to serve the static assets for swagger-ui behind my nginx proxy. My nginx config is:</p>
  
  <pre><code>server {
      server_name api.example.com;
      listen 443 ssl http2;
      listen [::]:443 ssl http2;
  
      location ^~ /docs {
          proxy_pass http://127.0.0.1:9505/;
      }
      location / { proxy_pass http://127.0.0.1:9005; }
  }
  </code></pre>
  
  <p>Where our main API responds at the root location, and proxies to the swagger docker container if /docs is specified in the url, launched via:</p>
  
  <pre><code>docker run -d -p 9505:8080 --name swagger -e API_URL=https://api.example.com/swagger.json swaggerapi/swagger-ui
  </code></pre>
  
  <p>I get the swagger-ui index.html contents when hitting <code>https://api.example.com/docs</code> but all the static assets 404 because they are trying to call <code>https://api.example.com/swagger-ui.css</code>, for example.</p>
  
  <p>I'd prefer not to put a <code>try_files</code> in my root location block because then I end up with a lot of extra processing forcing all normal API requests though the swagger proxy first before erroring and going into the proper API proxy.</p>
  
  <p>Is there some easy config change I'm missing about getting swagger to run at a sub-location like this?</p>