Commit 8a5e45c4 by Spencer Gibb

Merge branch 'routing-nostrip'

parents 658808a3 166ab388
......@@ -33,7 +33,6 @@ public class RibbonCommand extends HystrixCommand<HttpResponse> {
MultivaluedMap<String, String> params;
InputStream requestEntity;
public RibbonCommand(RestClient restClient,
Verb verb,
String uri,
......@@ -43,7 +42,6 @@ public class RibbonCommand extends HystrixCommand<HttpResponse> {
this("default", restClient, verb, uri, headers, params, requestEntity);
}
public RibbonCommand(String commandKey,
RestClient restClient,
Verb verb,
......@@ -76,11 +74,10 @@ public class RibbonCommand extends HystrixCommand<HttpResponse> {
}
}
HttpResponse forward() throws Exception {
private HttpResponse forward() throws Exception {
RequestContext context = RequestContext.getCurrentContext();
Builder builder = HttpRequest.newBuilder().
verb(verb).
uri(uri).
......
......@@ -10,4 +10,5 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties("zuul.proxy")
public class ZuulProxyProperties {
private String mapping = "/proxy";
private boolean stripMapping = true; // this is currently the default behaviour
}
......@@ -44,9 +44,14 @@ public class PreDecorationFilter extends ZuulFilter {
String requestURI = ctx.getRequest().getRequestURI();
//remove proxy prefix TODO: only if embedded proxy
String proxyMapping = properties.getMapping();
final String uriPart = requestURI.replace(proxyMapping, ""); //TODO: better strategy?
final String uriPart;
if (properties.isStripMapping()) {
uriPart = requestURI.replace(proxyMapping, ""); //TODO: better strategy?
} else {
uriPart = requestURI;
}
ctx.put("requestURI", uriPart);
LinkedHashMap<String, String> routesMap = routes.getRoutes();
......
......@@ -9,6 +9,9 @@ eureka:
zuul:
proxy:
mapping: /api
stripMapping: false
route:
testclient: /testing123
stores: /stores
testclient: /api/testing123
stores: /api/stores
customers: /api/customers
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment