Using the JSON API via HTTPS and HTTP

We have developed a mobile application using the JSON API plugin.

The current website is running on HTTP, we are planning to change the website to HTTPS.

Currently, mobile users on the live app are on HTTP; if we change the website to HTTPS then the app doesn't work so we have to publish a new app to work on HTTPS, but then the old app will not work, and we can't force a user to upgrade the app to the latest version.

We have a solution but we don't how to implement it: to make the website HTTPS and only the JSON API plugin to work on HTTP and HTTPS. How can we do this?

Topic plugin-json-api http api https Wordpress

Category Web


Whether HTTP or HTTPS should not make any difference. You should configure your webserver to "invoke" wordpress stack on both protocols requests to the domain and that should be enough (and this should be kind of default and recommended way in all relevant web server tutorials).

You can still change your web site URL to HTTPS, and that will mostly redirect all traffic to front end pages to HTTPS, but should not have impact on the REST API.


You can serve your site on both protocols http and https. This might be problem if you care about SEO (duplicate content).

You can use 301 redirection to force users to be redirected from http to https. Old app will be slightly slower because of redirection but it will be working. This might be problem if you use POST requests. There is 307 redirection but I don't have any experience with it.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.