Wednesday, November 13, 2013

How to change root context of the server redirect to API Store ?

WSO2 API Manager consists of two separate UIs for API Publishers and API Subscribers.  If the server hosted on a domain as apis.com on default ports, URLs of  store and publisher will be as follows.

API Store - https://apis.com:9443/store/
API Publisher - https://apis.com:9443/publisher/

If the user attempts to access https://apis.com:9443, it will redirect to the API Publisher URL by default. But if you need this root URL to be redirect to API Store instead of the API publisher, we could do it with the following changes.

In "{AM_HOME}/repository/components/plugins" directory contains a bundle called "org.wso2.am.styles_1.x.x.jar". Open this jar and find its component.xml resides in 'META-INF' directory. There, you could see 'default-context' has pointed to 'publisher'. You just need to change it to 'store' as follows and update the jar. Then restart the server.

<context>
       <context-id>default-context</context-id>
       <context-name>store</context-name>
       <protocol>http</protocol>
       <description>API Publisher Default Context</description>
</context>

Now, if you try to access the root URL of the server https://apis.com:9443, it will redirect to the API Store (https://apis.com:9443/store/).