maobaolong commented on code in PR #1965:
URL:
https://github.com/apache/incubator-uniffle/pull/1965#discussion_r1692572673
##########
dashboard/src/main/java/org/apache/uniffle/dashboard/web/proxy/WebProxyServlet.java:
##########
@@ -46,47 +52,56 @@ protected String rewriteTarget(HttpServletRequest
clientRequest) {
return null;
}
String targetAddress;
- if (clientRequest.getHeader("serverType").equals("coordinator")) {
- targetAddress =
coordinatorServerAddressesMap.get(clientRequest.getHeader("targetAddress"));
- if (targetAddress == null) {
- // Get random one from coordinatorServerAddressesMap
- targetAddress =
coordinatorServerAddressesMap.values().iterator().next();
- }
+ String requestServerType =
+ clientRequest.getHeader(HEADER_REQUEST_SERVER_TYPE) != null
+ && REQUEST_SERVER_TYPE_COORDINATOR.equalsIgnoreCase(
+ clientRequest.getHeader(HEADER_REQUEST_SERVER_TYPE))
+ ? REQUEST_SERVER_TYPE_COORDINATOR
+ : REQUEST_SERVER_TYPE_SERVER;
+ if (requestServerType.equalsIgnoreCase(REQUEST_SERVER_TYPE_COORDINATOR)) {
+ targetAddress =
+
coordinatorServerAddressesMap.get(clientRequest.getHeader(HEADER_TARGET_ADDRESS));
} else {
- targetAddress = clientRequest.getHeader("targetAddress");
+ targetAddress = clientRequest.getHeader(HEADER_TARGET_ADDRESS);
}
StringBuilder target = new StringBuilder();
- if (targetAddress.endsWith("/")) {
- targetAddress = targetAddress.substring(0, targetAddress.length() - 1);
- }
target.append(targetAddress).append("/api").append(clientRequest.getPathInfo());
String query = clientRequest.getQueryString();
if (query != null) {
target.append("?").append(query);
}
+ LOG.info(target.toString());
return target.toString();
}
- @Override
- protected void onProxyRewriteFailed(
- HttpServletRequest clientRequest, HttpServletResponse clientResponse) {}
-
+ /**
+ * If the proxy address fails to be requested, 403 is returned and the
front-end handles the
+ * exception.
+ *
+ * @param clientRequest
Review Comment:
These java docs seems generated by development tools, but uncompleted?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]