title: Redirect HTTP to HTTPS on Flask+Heroku
body: <p>When I attempt to redirect incoming traffic to https I get an infinite redirect loop.</p>
  
  <pre><code>@app.route('/checkout/')                                                                                                                                                                                        
  def checkout():                                                                                                                                                                                                 
      checkout = "https://myapp.herokuapp.com/checkout/"                                                                                                                                              
      if checkout != request.url:                                                                                                                                                                             
          print checkout, request.url                                                                                                                                                                             
          return redirect(checkout)                                                                                                                                                                               
      return render_template('checkout.html', key=keys['publishable_key']) 
  </code></pre>
  
  <p>The request.url is never changed to prefix https. I want to use heroku's piggyback ssl to minimize cost. </p>