spring-boot-admin: Can't access spring boot admin ui via nginx

Hi,

I was using spring boot admin old version with spring boot 1.5.X and it worked great. I’ve upgrade my env to use spring boot 2.3.1 version and I can’t access spring boot admin ui.

My env consist of dockerized microservices, all running behind nginx server with only https access. I’m also using eureka server to fetch the micro-service’s data. i’m trying to access the SBA container in http mode. in the browser’s network I see a ‘Mixed-content’ warning and https://admin/assets/img/favicon.png net::ERR_NAME_NOT_RESOLVED when trying to access some local resource. an access to the main end point returns response of 200 but when trying to get .js and .css resources from /assets path it fails/

the configuration in nginx.conf:

   location /{
              proxy_pass  http://admin:9090/;
           }

when I opened in internal port to the SBA container, thus passing around the nginx, the SBA UI is working fine.

my SBA configuration has no security settings and uses the most basic config. also, I use spring boot 2.2.7 version with 2.2.4 spring boot admin version

SBA application properties:

eureka.client.register-with-eureka=false
eureka.client.fetch-registry=true
eureka.client.registry-fetch-interval-seconds=5
eureka.instance.lease-renewal-interval-in-seconds=10
eureka.client.serviceUrl.defaultZone=http://127.0.0.1:9000/eureka/
server.forward-headers-strategy=native

I have tried:

  1. setting the spring boot admin ui to use only https
  2. configuring nginx with X-Farward… params
  3. setting spring.boot.admin.ui.public-url=http://admin:9090/
  4. trying to set SBA: server.tomcat.remote-ip-header=x-forwarded-for server.tomcat.protocol-header=x-forwarded-proto

there are no errors in SBA logs. attached are the warning and errors that I see in Chrome Untitled

your help is very much appriciated.

Thank you in advance Alex

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15

Most upvoted comments

@joshiste thanks for your help. I was finally able to make it work. I’ve added to nginx.conf
location /myPredefinedLocation/ { proxy_set_header Host $host; proxy_pass http://admin:9090/; }

and in addition: in SBA application.properites set the spring.boot.admin.ui.public-url=<machine_ip>/myPredefinedLocation The difference from 1.X SBA version is that when accessing some .css/.js resource the ip was copied with the localtion defined in ngnix.conf, where in the latest ver it just used the ip. for example: working scenario: https://<machine IP>/<my location defined in nginx.conf>/assets/css/chunk-common.d9ab30d2.css https://11.11.111.11/predefinedLocation/assets/css/chunk-common.d9ab30d2.css

non-working scenario: https://<machine IP>/<location is not copied>/assets/css/chunk-common.d9ab30d2.css https://11.11.111.11/assets/css/chunk-common.d9ab30d2.css

not sure why this was changed…

Thanks, Alex

The same thing happened to me too and I was missing the below directive in Nginx conf:

proxy_set_header X-Forwarded-Port $server_port;