Branko
Branko

Reputation: 91

How to disable Zuul modifying request URL when forwarding to a service?

This is my Zuul configuration (.yml file)

server:
  port: 8080
zuul:
  sensitiveHeaders:
  ignored-services: "*"
  routes:
    ui-service:
      path: /online-book-store/**
      serviceId: ui-service-v1
      stripPrefix: true
    auth-service:
      path: /auth/**
      serviceId: auth-service
    book-service:
      path: /book-service/**
      serviceId: book-service
    book-service-genres:
      path: /api/genres/**
      serviceId: book-service
  host:
    socket-timeout-millis: 10000
    connect-timeout-millis: 10000


eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:2580/eureka/

The problem i'm confronting is that when i send a request:

<zuul_gateway>/api/genres/listAll 

that request gets forwarded to <book-service>/listall and i would prefer it to be <book-service>/api/genres/listAll

So all of the "matched" path gets removed. How can i disable this "feature" .

Upvotes: 1

Views: 201

Answers (1)

Akshay Khopkar
Akshay Khopkar

Reputation: 189

Set stripPrefix: false to the book-service-genres. By default, matching prefixes are removed.

Upvotes: 2

Related Questions