Last active
August 29, 2015 14:00
-
-
Save sferich888/11187493 to your computer and use it in GitHub Desktop.
This can be used to ensure that the client using your application connected to OpenShift's SSL port prior to getting routed to your application.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.route('/endpoint') | |
def endpoint(): | |
# Check for SSL on OpenShift, that is used to force SSL for your endpoint. | |
## You have to check for the X-Forwarded-Proto because of the OpenShift Node Router terminating the SSL. | |
if request.headers.get('X-Forwarded-Proto', 'http') != 'https': | |
return redirect(request.url.replace("http://", "https://")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment