You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to run the demo-flask code however my application is configured behind nginx to allow for encryption over https. In the source code there is a note on HTTP_X_FORWARDED fields, and I don't believe I have these configured. I've tried searching to see if there was additional information but found nothing on github. Could you provide more information on this note? How would I change the configuration of the app and/or nginx to accomplish this?
I've created print() calls to help with troubleshooting. It looks like the application believes the protocol is http on port 443 instead of using https.
def prepare_flask_request(request):
# If server is behind proxys or balancers use the HTTP_X_FORWARDED fields
url_data = urlparse(request.url)
print (request.url)
print (url_data)
OUTPUT FROM LOG FILES:
http://example.com:443/?acs
ParseResult(scheme='http', netloc='example.com:443', path='/', params='', query='acs', fragment='')
So flask doesn't have access to the response.META features I believe this is something that is offered in django. I've still solved for this by just forcing all traffic through the https protocol, instead of allowing the logic to dictate what should be done.
I've also removed the port all together as its not needed in my application. Thanks for the help and the pointers on pdb; my background is not in development so this really helps.
Reacted by Doodad/Doodead, Kir Babkin and mlosapio
Activity
pitbulk commentedon Aug 27, 2015
Check this: SAML-Toolkits/python-saml#75
And in order to debug in python, use:
instead of the prints
FancyFane commentedon Aug 28, 2015
Hi pitbulk,
So flask doesn't have access to the response.META features I believe this is something that is offered in django. I've still solved for this by just forcing all traffic through the https protocol, instead of allowing the logic to dictate what should be done.
I've also removed the port all together as its not needed in my application. Thanks for the help and the pointers on pdb; my background is not in development so this really helps.