diff --git a/smoketest/compose/auth_proxy_alpha_config.yaml b/smoketest/compose/auth_proxy_alpha_config.yaml index 676f55b2b..18576b25a 100644 --- a/smoketest/compose/auth_proxy_alpha_config.yaml +++ b/smoketest/compose/auth_proxy_alpha_config.yaml @@ -4,7 +4,8 @@ upstreamConfig: proxyRawPath: true upstreams: - id: cryostat - path: / + path: ^/cryostat/(.*)$ + rewriteTarget: /$1 uri: http://cryostat:8181 - id: grafana path: /grafana/ diff --git a/src/main/java/io/cryostat/discovery/CustomDiscovery.java b/src/main/java/io/cryostat/discovery/CustomDiscovery.java index 0d94ada2a..de1ba85b6 100644 --- a/src/main/java/io/cryostat/discovery/CustomDiscovery.java +++ b/src/main/java/io/cryostat/discovery/CustomDiscovery.java @@ -195,7 +195,7 @@ Response doV2Create( public Response delete(@RestPath URI connectUrl) throws URISyntaxException { Target target = Target.getTargetByConnectUrl(connectUrl); return Response.status(RestResponse.Status.PERMANENT_REDIRECT) - .location(URI.create(String.format("/api/v3/targets/%d", target.id))) + .location(URI.create(String.format("api/v3/targets/%d", target.id))) .build(); } diff --git a/src/main/java/io/cryostat/discovery/Discovery.java b/src/main/java/io/cryostat/discovery/Discovery.java index afac28aa5..54e024098 100644 --- a/src/main/java/io/cryostat/discovery/Discovery.java +++ b/src/main/java/io/cryostat/discovery/Discovery.java @@ -88,7 +88,7 @@ void onStart(@Observes StartupEvent evt) { @RolesAllowed("read") public Response getv21() { return Response.status(RestResponse.Status.PERMANENT_REDIRECT) - .location(URI.create("/api/v3/discovery")) + .location(URI.create("api/v3/discovery")) .build(); } diff --git a/src/main/java/io/cryostat/events/EventTemplates.java b/src/main/java/io/cryostat/events/EventTemplates.java index 61d80cee0..0807c0b30 100644 --- a/src/main/java/io/cryostat/events/EventTemplates.java +++ b/src/main/java/io/cryostat/events/EventTemplates.java @@ -53,8 +53,7 @@ public class EventTemplates { public Response listTemplatesV1(@RestPath URI connectUrl) throws Exception { Target target = Target.getTargetByConnectUrl(connectUrl); return Response.status(RestResponse.Status.PERMANENT_REDIRECT) - .location( - URI.create(String.format("/api/v3/targets/%d/event_templates", target.id))) + .location(URI.create(String.format("api/v3/targets/%d/event_templates", target.id))) .build(); } @@ -71,7 +70,7 @@ public Response getTargetTemplateV1( .location( URI.create( String.format( - "/api/v3/targets/%d/event_templates/%s/%s", + "api/v3/targets/%d/event_templates/%s/%s", target.id, templateName, templateType))) .build(); } diff --git a/src/main/java/io/cryostat/events/Events.java b/src/main/java/io/cryostat/events/Events.java index 8ed0df82f..e5fa7f83d 100644 --- a/src/main/java/io/cryostat/events/Events.java +++ b/src/main/java/io/cryostat/events/Events.java @@ -54,7 +54,7 @@ public Response listEventsV1(@RestPath URI connectUrl, @RestQuery String q) thro .location( URI.create( String.format( - "/api/v3/targets/%d/events%s", + "api/v3/targets/%d/events%s", target.id, q == null ? "" : "?q=" + q))) .build(); } diff --git a/src/main/java/io/cryostat/recordings/Recordings.java b/src/main/java/io/cryostat/recordings/Recordings.java index 981033b72..c01dc06f4 100644 --- a/src/main/java/io/cryostat/recordings/Recordings.java +++ b/src/main/java/io/cryostat/recordings/Recordings.java @@ -446,7 +446,7 @@ public List listForTarget(@RestPath long id) throws E public Response listForTargetByUrl(@RestPath URI connectUrl) throws Exception { Target target = Target.getTargetByConnectUrl(connectUrl); return Response.status(RestResponse.Status.PERMANENT_REDIRECT) - .location(URI.create(String.format("/api/v3/targets/%d/recordings", target.id))) + .location(URI.create(String.format("api/v3/targets/%d/recordings", target.id))) .build(); } @@ -501,7 +501,7 @@ public Response patchV1(@RestPath URI connectUrl, @RestPath String recordingName .location( URI.create( String.format( - "/api/v3/targets/%d/recordings/%s", + "api/v3/targets/%d/recordings/%s", target.id, recording.get().getId()))) .build(); } @@ -683,7 +683,7 @@ public Response createRecordingV1(@RestPath URI connectUrl) throws Exception { .location( URI.create( String.format( - "/api/v3/targets/%d/recordings", + "api/v3/targets/%d/recordings", Target.getTargetByConnectUrl(connectUrl).id))) .build(); } @@ -709,7 +709,7 @@ public Response deleteRecordingV1(@RestPath URI connectUrl, @RestPath String rec .location( URI.create( String.format( - "/api/v3/targets/%d/recordings/%d", target.id, remoteId))) + "api/v3/targets/%d/recordings/%d", target.id, remoteId))) .build(); } @@ -816,7 +816,7 @@ public Response uploadToGrafanaV1(@RestPath URI connectUrl, @RestPath String rec .location( URI.create( String.format( - "/api/v3/targets/%d/recordings/%d/upload", + "api/v3/targets/%d/recordings/%d/upload", target.id, remoteId))) .build(); } @@ -860,7 +860,7 @@ public Response getRecordingOptionsV1(@RestPath URI connectUrl) throws Exception Target target = Target.getTargetByConnectUrl(connectUrl); return Response.status(RestResponse.Status.PERMANENT_REDIRECT) .location( - URI.create(String.format("/api/v3/targets/%d/recordingOptions", target.id))) + URI.create(String.format("api/v3/targets/%d/recordingOptions", target.id))) .build(); } @@ -887,7 +887,7 @@ public Response patchRecordingOptionsV1(@RestPath URI connectUrl) { Target target = Target.getTargetByConnectUrl(connectUrl); return Response.status(RestResponse.Status.PERMANENT_REDIRECT) .location( - URI.create(String.format("/api/v3/targets/%d/recordingOptions", target.id))) + URI.create(String.format("api/v3/targets/%d/recordingOptions", target.id))) .build(); } @@ -981,7 +981,7 @@ public Response createAndRedirectPresignedDownload(@RestPath long id) throws Exc .location( URI.create( String.format( - "/api/v3/download/%s?f=%s", + "api/v3/download/%s?f=%s", encodedKey, base64Url.encodeAsString( savename.getBytes(StandardCharsets.UTF_8))))) diff --git a/src/main/java/io/cryostat/reports/Reports.java b/src/main/java/io/cryostat/reports/Reports.java index daafcbdd9..4c8cfd32f 100644 --- a/src/main/java/io/cryostat/reports/Reports.java +++ b/src/main/java/io/cryostat/reports/Reports.java @@ -113,7 +113,7 @@ public Response getV1(@RestPath String recordingName) { .location( URI.create( String.format( - "/api/v3/reports/%s", entry.getKey(), entry.getValue()))) + "api/v3/reports/%s", entry.getKey(), entry.getValue()))) .build(); } @@ -145,7 +145,7 @@ public Response getActiveV1(@RestPath String targetId, @RestPath String recordin .location( URI.create( String.format( - "/api/v3/targets/%d/reports/%d", + "api/v3/targets/%d/reports/%d", target.id, recording.remoteId))) .build(); } diff --git a/src/main/java/io/cryostat/targets/Targets.java b/src/main/java/io/cryostat/targets/Targets.java index e7db592a9..6e2939e9c 100644 --- a/src/main/java/io/cryostat/targets/Targets.java +++ b/src/main/java/io/cryostat/targets/Targets.java @@ -33,7 +33,7 @@ public class Targets { @RolesAllowed("read") public Response listV1() { return Response.status(RestResponse.Status.PERMANENT_REDIRECT) - .location(URI.create("/api/v3/targets")) + .location(URI.create("api/v3/targets")) .build(); }