Using the rewriter in the OpenAPI element, you can rewrite the host, port, or path of an OpenAPI.
-
Go to the
examples/routing-traffic/rewriter/openapidirectory. -
Take a look at the base URL in the
demo-api-v1.yml:servers: - url: http://localhost:2000/demo-api/v1/
-
Execute
membrane.shormembrane.cmd. -
Review the proxies.xml configuration.
<api port="2000"> <openapi location="demo-api-v1.yml" validateRequests="yes"> <rewrite host="predic8.de" port="3000" basePath="/foo"/> </openapi> </api>
- Open localhost:2000/api-docs and click on
Demo API. - The base path of the OpenAPI will be rewritten to
/foo. - The host will be rewritten to
predic8.de. - The port will be rewritten to
3000.
- Open localhost:2000/api-docs and click on