Spring Cloud Skipper shell - не подходит HttpMessageConverter

Я использую Spring Cloud Skipper за прокси-сервером NGINX. Когда я пытаюсь подключиться к серверу Skipper с помощью локальной оболочки, работающей на ноутбуке с использованием прокси-адреса,

I get the error: Could not extract response: no suitable HttpMessageConverter found for response type [org.springframework.hateoas.Resources<org.springframework.cloud.skipper.domain.Deployer>] and content type [text/html]
Details of the error have been omitted. You can use the stacktrace command to print the full stacktrace.

Я пробовал URL прокси Skipper NGINX, как. https://example.com/skipper/api/about и https://example.com/skipper/api/deployers в браузере и инструментах разработчика браузера показывает, что заголовок ответа content-type: application/hal+json;charset=UTF-8

Запуск Skipper непосредственно на хосте, где работает сервер Skipper с локальным URL, работает нормально. Ошибка происходит только при доступе через URL прокси NGINX.

Could not extract response: no suitable HttpMessageConverter found for response type [org.springframework.hateoas.Resources<org.springframework.cloud.skipper.domain.Deployer>] and content type [text/html]
Details of the error have been omitted. You can use the stacktrace command to print the full stacktrace.

org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [org.springframework.hateoas.Resources<org.springframework.cloud.skipper.domain.Deployer>] and content type [text/html]
        at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:121)
        at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:995)
        at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:978)
        at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:737)
        at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:710)
        at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:628)
        at org.springframework.hateoas.client.Traverson$TraversalBuilder.toObject(Traverson.java:344)
        at org.springframework.cloud.skipper.client.DefaultSkipperClient.listDeployers(DefaultSkipperClient.java:335)
        at org.springframework.cloud.skipper.shell.command.PlatformCommands.list(PlatformCommands.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:246)
        at org.springframework.shell.Shell.evaluate(Shell.java:180)
        at org.springframework.shell.Shell.run(Shell.java:142)
        at org.springframework.shell.jline.InteractiveShellApplicationRunner.run(InteractiveShellApplicationRunner.java:84)
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:804)
        at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:794)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:324)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
        at org.springframework.cloud.skipper.shell.ShellApplication.main(ShellApplication.java:32)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) 

2 ответа

Решение

Установка следующего свойства application.yml решает проблему.

      server:
        use-forward-headers: true

Основная причина этой проблемы: TLS завершается на прокси-сервере, а Spring Cloud Skipper работает на порту "http" за прокси-сервером Nginx. Итак, весенние облачные шкиперы hateoas генерируют ссылки "http" вместо "https". Когда оболочка пытается "получить" URL-адреса (http), возвращенные hateoas Spring Cloud Skipper, прокси-сервер запрашивает перенаправление на https с 308, что вызывает исключение.

В настоящее время я отключил перенаправление на уровне ресурсов входа Kubernetes Nginx с аннотацией "nginx.ingress.kubernetes.io/ssl-redirect: false".

Более подробную информацию я опубликую позже, когда выясню, как настроить заголовки прокси-сервера для генерации URL-адресов "https" вместо http в Spring Cloud Skipper.

Или другим решением может быть настройка сквозного прохождения TLS в Proxy и прекращение TLS в Skipper путем включения TLS в Skipper.

Другие вопросы по тегам