title: redirecting the URL from cloudfront to API Gateway based on path
body: <p>I am trying to achieve redirection from cloudfront to API gateway based on the path.
  I have my UI with a cloudfront distribution with source being S3 bucket hosted on for eg.</p>
  <pre><code>www.example.com
  </code></pre>
  <p>and it serves the requests.</p>
  <p>I want the URLs with the pattern</p>
  <pre><code>www.example.com/share/*
  </code></pre>
  <p>to be redirected to API Gateway. The API Gateway has redirection internally where it points to other URLs.</p>
  <p>If I use the API gateway endpoint directly in the browser, it fetches the expected result.</p>
  <p>I am unsure of how to redirect from cloudfront to API Gateway. I have put cloudwatch logs on API Gateway and can see that cloudfront to API Gateway Redirection isn't working.</p>
  <p>I have tried adding API Gateway as origin and add the same as a behaviour in cloudfront, but no success.</p>