-
-
Notifications
You must be signed in to change notification settings - Fork 546
Closed
Labels
Description
When springdoc.api-docs.path
is defined to for example /documents/v3/api-docs
server url becomes invalid:
"servers": [
{
"url": "http://loca",
"description": "Generated server url"
}
],
the url should be http://localhost:8080
The culprit seems to be this snippet of code, where prefix
becomes /documents
, but apiDocsUrl
already contains the prefix: /documents/v3/api-docs
, so the prefix length gets subtracted twice.
Lines 145 to 152 in 31ba90b
protected String getServerUrl(HttpServletRequest request, String apiDocsUrl) { | |
String requestUrl = decode(request.getRequestURL().toString()); | |
Optional<SpringWebProvider> springWebProviderOptional = springDocProviders.getSpringWebProvider(); | |
String prefix = StringUtils.EMPTY; | |
if (springWebProviderOptional.isPresent()) | |
prefix = springWebProviderOptional.get().findPathPrefix(springDocConfigProperties); | |
return requestUrl.substring(0, requestUrl.length() - apiDocsUrl.length() - prefix.length()); | |
} |

Version info
Spring boot version 3.5.5
springdoc-openapi-starter-webmvc-ui : 2.8.12