question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't access spring boot admin ui via nginx

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13

github_iconTop GitHub Comments

1reaction
AlexBattcommented, Aug 23, 2020

@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

1reaction
suryachcommented, Aug 19, 2020

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;

Read more comments on GitHub >

github_iconTop Results From Across the Web

codecentric/spring-boot-admin - Gitter
I'm working on creating custom endpoints along with a custom Vue Component to consume it. Should my custom endpoint show up in my...
Read more >
Spring Boot Admin Reference Guide - GitHub Pages
The UI is just a Vue.js application on top of the Spring Boot Actuator endpoints. Support for Python applications is available using Pyctuator....
Read more >
Can't access spring boot admin behind zuul gateway-Springboot
For accessing spring boot admin via zuul, you need to specify property spring.boot.admin.ui.public-url , the value of the property will be your zuul...
Read more >
A Guide to Spring Boot Admin | Baeldung
Learn how to monitor and manage the Spring Boot applications using Spring Boot Admin.
Read more >
spring boot admin Cannot get information from client
Running the admin/client in debug mode will give more detailed logs in terms what exact url server is trying to hit and does...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found