Home > Mobile >  Flask Azure Webapp AADSTS50011: The redirect URI '<url>/getAToken' returning http in
Flask Azure Webapp AADSTS50011: The redirect URI '<url>/getAToken' returning http in

Time:07-09

I followed the microsoft code for flask application. Localhost went well however to change the version in production, even inserting the redirect url as https, the application insists on sending http and the error occurs.

error

I noticed that in github actions, the final URL is http, even putting the ssl_context = 'adhoc' on app.run command.

I don't know if it's possible to force https on github actions.

Reinforcing: localhost all went well. But Azure accepts http://localhost and nothing more.

Please help!

redirect uri print

github actions print 1

github actions print 2

CodePudding user response:

we can just inform Flask that it is running behind a proxy. wrap your application with Werkzueg’s ProxyFix middleware

from flask import Flask
from werkzeug.contrib.fixers import ProxyFix

app = Flask(__name__)
app.wsgi_app = ProxyFix(app.wsgi_app)
  • With the help of this , Flask will learn how to make sure whether a request was truly made using HTTP or HTTPS.

  • Also refer @rayluo comment in GitHub

Please refer Proxy Setups for more information

  • Related