I configured the cloud config server and cloud gateway server in my local environment. (Spring boot 3.1.5, springCloudVersion : 2022.0.4 )
This is the geteway information configured on my cloud config server.
server:
port: 8072
eureka:
instance:
prefer-ip-address: true
client:
register-with-eureka: true
fetch-registry: true
service-url:
defaultZone: http://localhost:8070/eureka
spring:
cloud:
gateway:
routes:
- id: organization-service
uri: lb://organization-service
predicates:
- Path=/organization/**
filters:
- RewritePath=/organization/(?<path>.*), /$\{path}
management:
endpoints:
web:
exposure:
include: "*"
enabled-by-default: true
When I change the routing information, 'http://{geteway-host}/actuator/refresh' updates the routing information, but 'http://{geteway-host}/actuator/gateway/refresh' does not work.
Why? Could you please explain what '/actuator/gateway/refresh' is for? Why isn't the routing information updated?
I referred to the official document and changed the gateway routing information in the cloud config server. Then, I called '/actuator/gateway/refresh' and checked whether the routing information changed. But this didn't work.
I checked the Spring cloud gateway source code.
'/actuator/gateway/refresh' fires the following events. As you can see, there is no command to reload the configuration file of the Config Server. I feel like the explanation in the book I was studying is insufficient.
Router configuration via Java DSL or properties is combined in the CompositeRouteLocator class. And this is finally cached using the CachingRouteLocator class. This event initializes this cache. It may be possible to manage routing information in a specific repository and use it for refresh when changes occur.
If there are any errors, please let me know. Thank you.