I would like to introduce a feature request for Zuul proxy routing. I believe that I would be quite common to have use case when you wish to redirect the user to specific Eureka discovered service, but including some additional context path.
Currently only by specifing the 'url' attribute it's possible to specifiy the specific context paths i.e.:
user:
path: /user/**
url: http://localhost:9999/uaa/user
What I would like to also be able to do is to specify custom context path together with serviceId:
For instance the config could look at fallows:
user:
path: /user/**
serviceId: auth-service
servicePath: uaa/user
There is also ralated issue that would have to be addressed: https://github.com/spring-projects/spring-hateoas/issues/367 - to fix it would require to give user more control of X-Forward-Prefix header.
This seems to be more or less what you asked for here: https://github.com/spring-projects/spring-hateoas/issues/367? What you really need is to set the outgoing X-Forwarded-Prefix as well in a specific way (perhaps you could add that to the description?).
Has there been any update on this? We are still facing this issue and would appreciate any comments. Thanks!
No change. Contributions welcome.
I created my own pre routing filter for some legacy wars deployed in a tomcat where url-s need to be rewritten.
Some code:
private Map<String,String> rewriteRules = new HashMap<String, String>()
{
{
put("/a", "/somecontextpath1/a");
put("/b", "/somecontextpath2/b");
}
};
...
@Override
public Object run() {
LOGGER.debug("Rewriting urls for legagy gateway");
RequestContext context = RequestContext.getCurrentContext();
String contextURI = (String) context.get("requestURI");
if (contextURI != null) {
if (rewriteRules.containsKey(contextURI)) {
LOGGER.debug("Rewriting url for " + contextURI);
context.put("requestURI", rewriteRules.get(contextURI));
}
}
return null;
}
how about changing the the way that the request is routed by defining a url? It would be nice to have something like this: http://{serviceName}/uaa/user; just like using rest template.
This module has entered maintenance mode. This means that the Spring Cloud team will no longer be adding new features to the module. We will fix blocker bugs and security issues, and we will also consider and review small pull requests from the community.
Most helpful comment
how about changing the the way that the request is routed by defining a url? It would be nice to have something like this: http://{serviceName}/uaa/user; just like using rest template.