I am trying to create a gateway+microservice setup (using jhipster 7.8.1) something similar to this sample but without eureka service discovery.
After generation, the applications boots fine but the UI (in my case Angular) is unable to reach the microservice (i.e unable to perform CRUD operation - I see 404 in the gateway). I did some initial digging and found the following in application.yml in gateway app
spring:
application:
name: gateway
cloud:
gateway:
default-filters:
- JWTRelay
discovery:
locator:
enabled: true
lower-case-service-id: true
predicates:
- name: Path
args:
pattern: "'/services/'+serviceId.toLowerCase()+'/**'"
filters:
- name: RewritePath
args:
regexp: "'/services/' + serviceId.toLowerCase() + '/(?<remaining>.*)'"
replacement: "'/${remaining}'"
which seems to be doing the routing, especially
spring.cloud.gateway.discovery.locator.enabled:true
seems to be doing the magic of mapping the apps registered with the discovery service to be available for gateway proxy'ing (reference)
I looked into the template in the jhipster's code base and did not find any other implementation for the no discovery service option.
For the no discovery service option I was expecting to see (with my limited knowledge of gateway) some explicit route mapping in the gateway to my microservices. Am i missing something or do I have to tweak something in the gateway to make it work without the discovery service.
Any help is greatly appreciated...
Note: I was able to run my setup as expected with eureka discovery (jhipster registry)