diff --git a/src/main/java/org/jenkinsci/plugins/prometheus/MetricsRequest.java b/src/main/java/org/jenkinsci/plugins/prometheus/MetricsRequest.java index dba89d37c..dec733d98 100644 --- a/src/main/java/org/jenkinsci/plugins/prometheus/MetricsRequest.java +++ b/src/main/java/org/jenkinsci/plugins/prometheus/MetricsRequest.java @@ -17,6 +17,8 @@ public static HttpResponse prometheusResponse(final CollectorRegistry collectorR public void generateResponse(StaplerRequest request, StaplerResponse response, Object node) throws IOException, ServletException { response.setStatus(StaplerResponse.SC_OK); response.setContentType(TextFormat.CONTENT_TYPE_004); + response.addHeader("Cache-Control","must-revalidate,no-cache,no-store"); + StringWriter buffer = new StringWriter(); TextFormat.write004(buffer, collectorRegistry.metricFamilySamples()); @@ -25,4 +27,4 @@ public void generateResponse(StaplerRequest request, StaplerResponse response, O } }; } -} \ No newline at end of file +}