title: How to simulate aws cloudfront multiple origins in a local developer environment
body: <p>Cloudfront has the nice feature of allowing different paths to go to different origins.  We use this to power a purely client side single page app that is served from S3 and AJAXs to multiple services, with a simplified example setup being:</p>
  <blockquote>
  <p>mydistribution.cloudfront.net/path1 --&gt; load balancer A serving service A</p>
  <p>mydistribution.cloudfront.net/path2 --&gt; load balancer B serving service B</p>
  <p>mydistribution.cloudfront.net/frontend ---&gt; S3 bucket that hosts the single page app JS/CSS/HTML that makes AJAX calls to the services</p>
  </blockquote>
  <p>I am looking for a way to set up a local environment to mimick this part of the behaviour so that different local paths on the same url/port can resolve to different local running services on different ports.  The importance is so that CORS and other cross domain issues, which are not present in the non-local setup as everything happens on the same domain/port, will not affect local development.   How is this best achieved?</p>
  <p>For example (all the things on the right are already set up and running on the right ports)</p>
  <blockquote>
  <p>localhost:8080/path1 --&gt; A local web application server running 8091</p>
  <p>localhost:8080/path2 --&gt; A local web application server on port 8090</p>
  <p>localhost:8080/frontend --&gt; A local node server on port 8081 serving
  the HTML/JS/CSS</p>
  </blockquote>