Swagger работает локально через http:
Я добавил Swagger, который отлично работает на моем локальном хосте:
http://localhost:8085/swagger-ui/index.html#/

Swagger не работает удаленно через https:
Однако при развертывании его на удаленном сервере я получаю следующую ошибку:
https://mycompany.co/pow-wow/swagger-ui/index.html#/

Ошибка
Не удалось загрузить удаленную конфигурацию.
примечание: доступ к удаленному серверу осуществляется через https.
Конечные точки REST доступны на удаленный сервер.
например. GET https://mycompany.co/pow-wow/powwow/test-me возвращает 200, как и ожидалось.
Вопрос
Как получить доступ к Swagger через удаленный сервер?
Код
pom.xml
Код: Выделить всё
org.springdoc
springdoc-openapi-ui
1.6.7
Код: Выделить всё
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
//http.csrf().disable().authorizeRequests().antMatchers("/powwow/*").hasRole("USER").and().httpBasic();
//http.csrf().disable().authorizeRequests().antMatchers("/*").permitAll().and().httpBasic();
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
.authorizeRequests().antMatchers("/soapWS/**").permitAll().and()
.authorizeRequests().antMatchers("/swagger-ui/**", "/v3/api-docs/**").permitAll().and()
.authorizeRequests().antMatchers("/actuator/**").permitAll()
.anyRequest().authenticated().and()
.httpBasic().and()
.csrf().disable();
}
}
При просмотре сетевого трафика в браузере при доступе к Swagger.
Локально происходит вызов:
http://localhost:8085/v3/api-docs/swagger-config
возврат:

Код: Выделить всё
{"configUrl":"/v3/api-docs/swagger-config","oauth2RedirectUrl":"http://localhost:8085/swagger-ui/oauth2-redirect.html","url":"/v3/api-docs","validatorUrl":""}
https://mycompany.co/v3/api-docs/swagger-config
который возвращает 302.

Но https://mycompany.co/pow-wow/v3/api-docs/swagger-config
возвращает:
Код: Выделить всё
{"configUrl":"/v3/api-docs/swagger-config","oauth2RedirectUrl":"http://localhost:8085/swagger-ui/oauth2-redirect.html","url":"/v3/api-docs","validatorUrl":""}
Подробнее здесь: https://stackoverflow.com/questions/718 ... figuration
Мобильная версия