Month: May 2018

How to integrate SSL in ionic 3 using cordova plugin


It was a little bit hard task for me to integrate SSL in my Ionic 3 app using Cordova due to my lack of knowledge in SSL certificates. As usual i just landed in the HTTP native plugin section under ionic frameworks documentation section. It was not so helpful for me, because neither  this page or its official github page not explaining how to generate the .cer file for SSL pinning, finally i found the solution by reading lots of Stackoverflow answers and other articles.


Install the plugin as per the instruction on the documentation section

How to get the .cer file ?

I’m assuming that you need to make https requests to a single domain only

Method 1

It works only if you had chrome browser on a windows machine with no active antivirus software ( In my case kaspersky using a personal root certificate – that mask the actual SSL certificate keyfile from the user  )

In this case, we can generate .cer file from your chrome browser on windows machine. Just access one of your public api url via chrome browser address bar and then click on the green padlock icon of your https url. then you can export the ssl public key as a .cer file

Watch this video to get clear understanding


Method 2 ( recommended one )

If you have a Linux or Mac machine or use you Linux server terminal – If your machine must have an installation of openssl.

Use the following linux command to obtain the .cer file

openssl s_client -showcerts -connect <domain name>:443 -servername <domain name>:443 </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > certificate.pem

Convert .pem file into .cer file

openssl x509 -inform PEM -in certificate.pem -outform DER -out certificate.cer

Download the certificate.cer file to your local machine and then include a copy on your ionic/cordova project root directory

You must call enableSSLPinning or setSSLCertMode method on your components.ts file based on the version of the installed plugin

That’s all!

How to setup subdomain and virtual host in ubuntu 16.04 bitnami server


This article will be helpful for those who is using Ubuntu 16.04 – bitnami based server on amazon aws EC2 instance only. I’m writing this blog post because, i did’t find any best blogs which explain how to create a subdomain in aws ec2 instance and which also using bitnami based image to configure the instance. I can see, so many blogs and stackoverflow results about this topic, but most of those are talking about creation of virtual host on the standard ubuntu server only. Actually creation of the virtual host was the complex task for me at first and subdomain creation is almost easy.


Steps to create virtual host and create subdomain in bitnami based ubuntu server

  1. Login on your sever via terminal window with bitnami as the user
  2. Copy demo directory from /home/bitnami/stack/docs/demo to a new location ( You may rename the directory “demo” as something else )
  3. Change the path and hostname on the config files on the new demo directory with new file paths ( in my example, it is located in /home/bitnami/htdocs/demo )
  4. Include the path /home/bitnami/htdocs/demo/conf/httpd-vhosts.conf  on the /home/bitnami/stack/apache2/conf/bitnami/bitnami-apps-vhosts.conf file
  5. Restart the apache2 server ( sudo /opt/bitnami/ restart )
    (  Virtual host creatio has been completed )
  6. Create a subdomain record ( ‘A’ Record ) on aws route53
  7. Check the sub domain on the browser after 5 minutes
  8. Upload your files to your subdomain root directory
  9. Hire me if you need more help ( optional  🙂

Please watch this video to get more clarity on this.