Valeriy K.
Valeriy K.

Reputation: 2904

SpringBootAdmin doesn't works properly with SpringBootGateway

I have SpringBootAdmin application registered in Eureka server. Also, I'm using the SpringBootGateway server to launch all my microservices.

My admin server configuration is next:

cloud:
  gateway:
    discovery:
      locator:
        enabled: true
        lower-case-service-id: true

server:
port: 50100

eureka:
client:
  serviceUrl:
    defaultZone: http://localhost:8761/eureka
instance:
  preferIpAddress: true

So I can get all my servers by name. I called my admin server "admin" - spring.application.name=admin

When I trying to path throw gateway server on Spring admin server I see that Spring-admin server tries get front files from http://{gateway:port}/xxxxxx.js instead http://{gateway:port}/admin/xxxxxx.js, so I see a white page.

I found the same issue. It seems it was solved. But I see that no. I use 'de.codecentric:spring-boot-admin-starter-server:2.1.4'. My backend controllers work properly - I can do request on http://{gateway:port}/admin/test and get expected response. How I can fix or configure routing for Spring boot admin frontend files? Thanks.

Upvotes: 1

Views: 1622

Answers (1)

David D
David D

Reputation: 177

You need to set configure your Admin server to use the gateway as it's public-url by configuring it like this:

spring:
  boot:
    admin:
      ui:
        public-url: "http://{gateway:port}/admin/"

See https://codecentric.github.io/spring-boot-admin/current/#_running_behind_a_front_end_proxy_server

Upvotes: 2

Related Questions