UPDATE: spring-cloud-netflix won't do this out-of-the-box with easy configuration, but it's actually easy to add a custom ZuulFilter that does what you need. See How do you you create custom Zuul filters in Spring Cloud?
I think something like this should work for you:
@Component
public class MyCustomZuulFilter extends ZuulFilter {
private urlPathHelper = new UrlPathHelper();
@Override
public Object run() {
RequestContext ctx = RequestContext.getCurrentContext();
final String requestURI =
this.urlPathHelper.getPathWithinApplication(ctx.getRequest());
if ("/app/login".equals(requestURI)
&& ctx.getRequest() != null
&& !StringUtils.isBlank(ctx.getRequest().getMethod())) {
if ("DELETE".equals(ctx.getRequest().getMethod().toUpperCase())) {
ctx.set("serviceId", "XYZ-SVC");
ctx.setRouteHost(null);
ctx.addOriginResponseHeader("X-Zuul-ServiceId", location);
} else if ("POST".equals(ctx.getRequest().getMethod().toUpperCase())) {
ctx.set("serviceId", "ABC-SVC");
ctx.setRouteHost(null);
ctx.addOriginResponseHeader("X-Zuul-ServiceId", location);
}
}
return null;
}
}
Note that you may still need a Zuul rule that maps /app/login to an existing service depending on your setup, as the bundled PreDecorationFilter automatically sets unrecognized routes as "forward.to".
I have exactly the same use case, but Zuul doesn't appear to be able to route based on HTTP method at the moment.
The code in question is in ProxyRouteLocator#getMatchingRoute method. It iterates through the defined ZuulRoute entries to find matching routes. The logic in #getMatchingRoute and the properties of ZuulRoute don't appear to match on HTTP method, unfortunately.