8

Using zuul, is it possible to configure routes to use parts from the path in the url?

This meta code config using normal regexp explains what I'd like to do.

zuul:
  routes:
    foobar:
      path: /foo/{.*}/bar/{.*}
      url: http://foobar/\2/\1

So /foo/123/bar/456 would be routed to http://foobar/456/123

Andreas Wederbrand
  • 38,065
  • 11
  • 68
  • 78

1 Answers1

2

You can write your own routing filter, example: https://cloud.spring.io/spring-cloud-netflix/multi/multi__router_and_filter_zuul.html#_how_to_write_a_route_filter

Jeff
  • 1,871
  • 1
  • 17
  • 28
  • Yeah, of course. But I'm hoping for built in support from the properties files. – Andreas Wederbrand Oct 19 '17 at 18:38
  • Besides, that might be thought of as routing but it actually terminates the request and sends a new request to the origin/downstream service. I'd like to be able to just stream the request to the correct origin/downstream service. As I think happens with normal routes in Zuul. – Andreas Wederbrand Nov 16 '17 at 10:09
  • You seem to be able to do this with the new Spring Cloud Gateway, https://github.com/spring-cloud/spring-cloud-gateway/blob/master/spring-cloud-gateway-sample/src/main/java/org/springframework/cloud/gateway/sample/GatewaySampleApplication.java Is this a possible alternative? – Jeff Nov 23 '17 at 07:54
  • Perhaps. They just released 1.0 and I don't think it's battle proven yet. I'll give it .a test run. – Andreas Wederbrand Nov 23 '17 at 22:23