You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug description
This issue was already described in #283
The first time the /v3/api-docs endpoint is called, the server servers[0].url property is calculated and after that it is used from a cache for all subsequent calls (direct, via SwaggerUI etc.).
This issue will not manifest itself when there is only one valid path to your application (e.g. via reverse proxy url https://mydomain.com). But when there are multiple paths (like public https + plaintext http requests from internal infrastructure) this problem arises.
To Reproduce
Start the application:
send request №1:
Now RESTART application and send previous requests in REVERSE ORDER (request №2, then request №1).
This time request №2 will generate correct servers[0].url=http://localhost:8080
But subsequent request №1 also shows http://localhost:8080 when https://myhost.com expected.
Expected behavior
Correct servers.url property generated in openapi.json for each incoming request (based on request's x-forwarded-* headers or their absense) not only the first one.
Additional context
SpringDoc version used 1.5.2
Changing server.forward-headers-strategy Spring property and other tricks from FAQ do not affect this behavior.
Situation even more confusing when there are multiple Api Groups defined. They will cache servers[].url property independently from each other.
The text was updated successfully, but these errors were encountered:
This is reproducible since 1.4.4 and was introduced with 26458dd
So since 1.4.4 the servers of a cachedOpenAPI are never updated.
updateServers() sets the servers of the cachedOpenAPI so setServersPresent(true) is called which prevents any action in updateServers()
if (!CollectionUtils.isEmpty(openAPIBuilder.getCachedOpenAPI().getServers()))
openAPIBuilder.setServersPresent(true);
openApi = openAPIBuilder.updateServers(openAPIBuilder.getCachedOpenAPI());
@bnasslahsen from my perspective I don't think this is intended behaviour and should be fixed.
Bug description
This issue was already described in #283
The first time the /v3/api-docs endpoint is called, the server servers[0].url property is calculated and after that it is used from a cache for all subsequent calls (direct, via SwaggerUI etc.).
This issue will not manifest itself when there is only one valid path to your application (e.g. via reverse proxy url https://mydomain.com). But when there are multiple paths (like public https + plaintext http requests from internal infrastructure) this problem arises.
To Reproduce
Start the application:
send request №1:
in resulting json generated servers entry is correct servers[0].url=https://myhost.com .
Send request №2:
Expected: In generated json spec servers[0].url=http://localhost:8080 .
Actual: In generated json spec still servers[0].url=https://myhost.com
Now RESTART application and send previous requests in REVERSE ORDER (request №2, then request №1).
This time request №2 will generate correct servers[0].url=http://localhost:8080
But subsequent request №1 also shows http://localhost:8080 when https://myhost.com expected.
Expected behavior
Correct servers.url property generated in openapi.json for each incoming request (based on request's x-forwarded-* headers or their absense) not only the first one.
Additional context
SpringDoc version used 1.5.2
Changing server.forward-headers-strategy Spring property and other tricks from FAQ do not affect this behavior.
Situation even more confusing when there are multiple Api Groups defined. They will cache servers[].url property independently from each other.
The text was updated successfully, but these errors were encountered: