Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/main/java/org/gaul/s3proxy/S3ProxyHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ public final void doHandle(HttpServletRequest baseRequest,
String uri = request.getRequestURI();
String originalUri = request.getRequestURI();

// Check for the /version endpoint
if ("/healthz".equals(uri) && "GET".equalsIgnoreCase(method)) {
handleVersionRequest(response);
return;
}

if (!this.servicePath.isEmpty()) {
if (uri.length() > this.servicePath.length()) {
uri = uri.substring(this.servicePath.length());
Expand Down Expand Up @@ -2029,6 +2035,18 @@ private void handlePutBlob(HttpServletRequest request,

response.addHeader(HttpHeaders.ETAG, maybeQuoteETag(eTag));
}
private void handleVersionRequest(HttpServletResponse response) throws IOException {
response.setStatus(HttpServletResponse.SC_OK);
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");

String versionInfo = "{ \"status\": \"OK\"}";

try (PrintWriter writer = response.getWriter()) {
writer.write(versionInfo);
writer.flush();
}
}

private void handlePostBlob(HttpServletRequest request,
HttpServletResponse response, InputStream is, BlobStore blobStore,
Expand Down
Loading