Tuesday, June 19, 2012

redirect http to https for your openshift application

Want to use HTTPS for you openshift application? Yes, our application as mobile app's backend definitely needs this feature, I though there should be some other additional complex, obscure steps to enable HTTPS. But actually, it's very easy, just add .htaccess file in your wsgi directory(I'm using python, django application, you should do this according to your specific requirement).

here is the content for redirecting HTTP to HTTPS:

RewriteEngine on

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule .* https://%{HTTP_HOST}%{REQUEST} [R,L] 

Now, all your requests will be porting to HTTPS, if you have some cookies in your browser, you should clear those insecure cookies, otherwise you may can not login.

No comments:

Post a Comment