Fix: Swagger UI/OpenAPI под префиксом /pdf-converter, документация открыта без ключа
Прод (наружный nginx срезает /pdf-converter/): springdoc генерировал абсолютные URL от корня хоста — пути до /v3/api-docs и swagger-ui битые. server.forward-headers-strategy=framework + X-Forwarded-* (добавляет наружный nginx) дают server https://pjandro.ru/pdf-converter и configUrl с префиксом; 'native'-клапан Tomcat X-Forwarded-Prefix не понимает. ApiKeyFilter: матч по пути без forwarded-contextPath (под префиксным заголовком getRequestURI() включает префикс — HEALTHCHECK получил бы 401) + открытые без ключа /swagger-ui* и /v3/api-docs* (браузер не может положить ключ в заголовок при загрузке UI; /api/** под ключом). OpenApiConfig: @SecurityScheme X-API-Key — кнопка Authorize в UI, @SecurityRequirement на convert — «Try it out» с ключом. springdoc.swagger-ui.persist-authorization=true. Регрессии: ApiKeyFilterTest#docsOpenWithoutKey, #forwardedPrefix_healthStaysOpen, #forwardedPrefix_docsOpenWithoutKey (вместо удалённого openApiRequiresKey). AGENTS.md синхронизирован.
This commit is contained in:
+1
-1
@@ -41,7 +41,7 @@
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- /actuator/health — open-эндпоинт для Docker HEALTHCHECK (swagger в проде выключен) -->
|
||||
<!-- /actuator/health — open-эндпоинт для Docker HEALTHCHECK -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user