title: Permanent redirect my herokuapp domains endpoints to my custom domain in Flask
body: <p>Here is what I tried till now</p>
  <pre><code>new_url = https://example.com
  
  @app.route('/')
  def root():
      return redirect(new_url, code=302)
  
  @app.route('/&lt;path:page&gt;')
  def anypage(page):
      return redirect('{new_url}/{page}'.format(page=page, new_url=new_url), code=302)
  </code></pre>
  <br>
  <ul>
  <li>It's only working for home and error handler pages in the development environment</li>
  <li>Error showing too many redirects in the production environment</li>
  </ul>