How to rewrite the Base URL an OpenAPI

Using the rewrite in the openapi element, we can rewrite the base URL of an OpenApi by setting the host, port and base path. In this example the base URL is rewritten to predic8.de:3000/foo.

Ingredients

Configuration

<api port="2000">
    <openapi location="path/to/openapi.yml" validateRequests="yes">
        <rewrite host="predic8.de" port="3000" basePath="/foo" />
    </openapi>
</api>

Resources

openapi Example
rewriter Example