If you use Swagger UI for REST API documentation, it's relevant to set the correct host and basePath in the specification file. To use the current host and path, simply use the integrated filter. It will replace the host and basePath with current information:

  <filter>
    <filter-name>RestApiFilter</filter-name>
    <filter-class>com.sibvisions.apps.server.http.RestApiFilter</filter-class>
    <async-supported>true</async-supported>
  </filter>
 
  <filter-mapping>
    <filter-name>RestApiFilter</filter-name>
    <url-pattern>*.json</url-pattern>
  </filter-mapping> 

The filter only supports json specification files.