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.

gateway with eureka discovery only match upper case url

See original GitHub issue

Just test Finchley.RC1, and eureka server version is 1.4.4.RELEASE. use lower case service id will got 404, only upper case can find service.

find in DiscoveryClientRouteDefinitionLocator:

String serviceId = instance.getServiceId();

there get the upper case serviceId, and predicate will be ‘Path=/SERVICE_ID/**’.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

11reactions
bigbang4u2commented, Jul 28, 2018

Setting spring.cloud.gateway.discovery.locator.lowerCaseServiceId=true in gateway service will make your service id lowercase by default

0reactions
spencergibbcommented, Apr 27, 2018

After 3d2364a you can now do this:

spring.cloud.gateway.discovery.locator:
  filters: 
    - name: RewritePath
      args: 
        regexp: "'/' + serviceId.toLowerCase() + '/(?<remaining>.*)'"
        replacement: "'/$\\{remaining}'"
      
  predicates: 
    - name: Path
      args: 
        pattern: "'/'+serviceId.toLowerCase()+'/**'"

Though that is a lot of boiler plate for an option that will be used fairly often, so more to come.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Cloud API Gateway routing not working - Stack Overflow
It is related with the discovery server. eureka.instance.hostname=localhost. So if you don't know, just don't mess it up with wrong directions ...
Read more >
Spring Cloud configuration properties
Useful with eureka when it automatically uppercases serviceId. so MYSERIVCE, would match /myservice/**. spring.cloud.gateway.discovery.locator.predicates.
Read more >
Spring Cloud Gateway + Netflix Eureka Example - JavaInUse
In this tutorial we will be implementing Spring Cloud Gateway and get the microservices deployment url using Netflix Eureka Discovery Service.
Read more >
URLs Case Sensitive - How to Redirect Uppercase to ... - Inflow
How to Redirect Uppercase URLs to Lowercase. If you only have a few pages with capitalized URLs, you can simply set up some...
Read more >
Management & Monitoring - Micronaut Documentation
HTTP filters now support matching URLs by a regular expression. ... Micronaut now only comes with its own set of annotations to declare...
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