Home > OS >  Cannot Access new Management Server Port in Spring Boot Application
Cannot Access new Management Server Port in Spring Boot Application

Time:10-12

In my Spring Boot Application I changed the default management server port in order to expose it on different port through HTTP. My main app works on HTTPS with SSL key and I don't want to expose it there.

server.ssl.enabled=true
server.ssl.key-store-type=PKCS12
server.ssl.key-store=classpath:local-ssl.p12
server.ssl.key-store-password=<password>
server.ssl.key-alias=local_ssl
server.port=8443
management.server.ssl.enabled=false
management.server.port=8081
management.endpoints.web.exposure.include=health,info,prometheus

However when I am trying to access the http://localhost:8081/actuator/prometheus, I am receiving the following picture from Postman. How can I access my endpoints through the new port?

Postman Image

CodePudding user response:

When configured to use a custom port, the management server can also be configured with its own SSL using the various management.ssl.* properties. For example, this allows a management server to be available via HTTP while the main application uses HTTPS:

server.port=8443
server.ssl.enabled=true
server.ssl.key-store=classpath:store.jks
server.ssl.key-password=secret
management.port=8080
management.ssl.enabled=false

Alternatively, both the main server and the management server can use SSL but with different key stores:

server.port=8443
server.ssl.enabled=true
server.ssl.key-store=classpath:main.jks
server.ssl.key-password=secret
management.port=8080
management.ssl.enabled=true
management.ssl.key-store=classpath:management.jks
management.ssl.key-password=secret

for reference look here https://docs.spring.io/spring-boot/docs/1.5.4.RELEASE/reference/html/production-ready-monitoring.html

  • Related