Changing the root-context for apiman's gateway

An apiman user recently asked me how they could change the root context of apiman-gateway from /apiman-gateway/ to something else, for instance /i-love-apiman/.

If you’re using a load balancer or some other mapper, just skip to the Alternatives section or read the apiman production guide.

If you are using the WildFly or EAP apiman distributions (such as our quickstart), here’s an easy answer [1]:

  1. Unpack apiman-gateway.war.

    $ unzip apiman-gateway.war -d /tmp/apiman-gateway
  2. Edit /tmp/apiman-gateway/WEB-INF/jboss-web.xml to be to your new preferred context, e.g. i-love-apiman.

  3. Repack the war.

    $ zip -r apiman-gateway.war /tmp/apiman-gateway/META-INF /tmp/apiman-gateway/WEB-INF
  4. Replace the existing deployment.

  5. Alter your file and set apiman-gateway.public-endpoint=<new public endpoint>. [2]



When you publish an API to the gateway setup you modified, you should see something like this in the UI:



You can, of course, just set mappings on your load balancer (or some other technique external to apiman) if you want to avoid fiddling with the deployments. Even then, you’ll still probably want to set apiman-gateway.public-endpoint to report a sensible value for your setup.

One final note: you can set these options via Java’s system properties, too

$ ./bin/ -Dapiman-gateway.public-endpoint=https://localhost:8443/i-love-apiman/

1. This procedure would be slightly different for other platforms such as Vert.x, Tomcat, etc
comments powered by Disqus