Categories
Mastering Development

Permanent redirect my herokuapp domains endpoints to my custom domain in Flask

Here is what I tried till now

new_url = https://example.com

@app.route('/')
def root():
    return redirect(new_url, code=302)

@app.route('/<path:page>')
def anypage(page):
    return redirect('{new_url}/{page}'.format(page=page, new_url=new_url), code=302)

  • It’s only working for home and error handler pages in the development environment
  • Error showing too many redirects in the production environment

Leave a Reply

Your email address will not be published. Required fields are marked *