title: How to translate webpack dev server proxy options to nginx docker container?
body: <p>I am deploying a docker container, which includes my webapp (app 1) to a vm. I have another docker container (app 2) on the vm that is running on <code>port 8080</code>. I would like to proxy all url requests from <code>app 1</code> that start with <code>/api</code> to <code>app 2</code>.</p>
  
  <p>This is my DOCKER file:</p>
  
  <pre><code>FROM nginx:1.17.0
  MAINTAINER **** [**@**.com](mailto:**@**.com)
  
  COPY nginx.default /etc/nginx/sites-enabled/default
  
  ADD dist/ /usr/share/nginx/html/
  </code></pre>
  
  <p>These are my webpack dev server settings</p>
  
  <pre><code>devServer: {
      contentBase: outDir,
      // serve index.html for all 404 (required for push-state)
      historyApiFallback: true,
      proxy: {
        '/api': {
          target: 'http://aapp-name:8080',
          pathRewrite: { '^/api': '' },
          logLevel: 'debug'
        }
      }
    }
  </code></pre>
  
  <p>I have added the following to <code>nginx.default</code>, but it doesn't seem to be working.</p>
  
  <pre><code>location /api {
      proxy_pass http://app-name:8080;     
  }
  </code></pre>