Springboot Config server client returns status code: -1

1.9k views Asked by At

I'm trying to spin up a simple config server using native file location.

the configuration of the server looks like below

server:
  port: 9001

spring:
  cloud:
    config:
      server:
        native:
          search-locations: file://${HOME}/Desktop/config2

However, when the client server starts using the following configuration

server.port=9002
spring.application.name=client-server
spring.config.import=optional:configserver:http://localhost:9001/
2021-12-01 09:47:07.563  INFO 14992 --- [           main] o.s.b.context.config.ConfigDataLoader    : Fetching config from server at : http://localhost:9001/
2021-12-01 09:47:07.563  INFO 14992 --- [           main] o.s.b.context.config.ConfigDataLoader    : Connect Timeout Exception on Url - http://localhost:9001/. Will be trying the next url if available
2021-12-01 09:47:07.563  WARN 14992 --- [           main] o.s.b.context.config.ConfigDataLoader    : Could not locate PropertySource ([ConfigServerConfigDataResource@674bd420 uris = array<String>['http://localhost:9001/'], optional = true, profiles = list['local']]): I/O error on GET request for "http://localhost:9001/client-server/local": Invalid Http response; nested exception is java.io.IOException: Invalid Http response

Anyone got any ideas?

I debug into the resttemplate and the request formed ok, however the httpStatusCd returned is -1.

Thanks

1

There are 1 answers

0
clovenstone On

After some investigation and found this documentation from the spring-cloud web:

client_side_usage

by default the service is running on port 8888, after set

spring:
  cloud:
    config:
      allow-override: true

this allows the config-server to change the port, also the client is able to communicate to the config-server with the override port, i.e. 8887

after add the override change the client side looks like

server.port=9003
spring.application.name=client-server
spring.config.import=configserver:http://localhost:8887/