User:Polishdeveloper/BetaCluster Restbase access on localhost

From mediawiki.org

The easiest way to test RESTBase services with your local MWV instance you can point your apache2 configuration to use a production RESTBase server. With that approach, you don't have to install RESTBase server locally. Apache will redirect all RESTBase calls to the production server. In order to do it please follow those steps:

How to point to beta cluster RESTBase[edit]

1. Install necessary apache2 modules

 sudo a2enmod ssl proxy proxy_http

2. Create a confuration rule for apache2 to proxy RESTBase:

 sudo touch /etc/apache2/site-confs/devwiki/40-restbase.conf

3. Paste following config in your newly created 40-restbase.conf file using your favourite editor

 SSLProxyEngine On
 ProxyPass /api/rest_v1/ https://en.wikipedia.beta.wmflabs.org/api/rest_v1/ 

4. Restart apache2 service

 sudo service apache2 

5. You local apache2 will point to production instance, you can test it visiting an example URL:

 http://localhost:8080/api/rest_v1/page/summary/Planet

Those steps are valid for a MediaWiki-Vagrant environment. It also applies to to local apache instance. When using a custom MediaWiki installation you'll have to tell apache2 service to include configuration created in steps 2 & 3.

How to point to production RESTBase[edit]

If you want to point to production RESTBase instance in step 3 please change the beta cluster RESTBase URL to https://en.wikipedia.org/api/rest_v1/.