Skip to content
Snippets Groups Projects
Commit cd2a3bac authored by Emelia Smith's avatar Emelia Smith Committed by Claire
Browse files

Fix missing or incorrect cache-control headers for Streaming server (#32551)

parent f0e011fb
No related branches found
No related tags found
No related merge requests found
...@@ -235,7 +235,7 @@ const startServer = async () => { ...@@ -235,7 +235,7 @@ const startServer = async () => {
app.get('/favicon.ico', (_req, res) => res.status(404).end()); app.get('/favicon.ico', (_req, res) => res.status(404).end());
app.get('/api/v1/streaming/health', (_req, res) => { app.get('/api/v1/streaming/health', (_req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' }); res.writeHead(200, { 'Content-Type': 'text/plain', 'Cache-Control': 'private, no-store' });
res.end('OK'); res.end('OK');
}); });
...@@ -858,7 +858,7 @@ const startServer = async () => { ...@@ -858,7 +858,7 @@ const startServer = async () => {
} }
res.setHeader('Content-Type', 'text/event-stream'); res.setHeader('Content-Type', 'text/event-stream');
res.setHeader('Cache-Control', 'no-store'); res.setHeader('Cache-Control', 'private, no-store');
res.setHeader('Transfer-Encoding', 'chunked'); res.setHeader('Transfer-Encoding', 'chunked');
res.write(':)\n'); res.write(':)\n');
......
...@@ -98,9 +98,11 @@ export function setupMetrics(channels, pgPool) { ...@@ -98,9 +98,11 @@ export function setupMetrics(channels, pgPool) {
const requestHandler = (req, res) => { const requestHandler = (req, res) => {
metrics.register.metrics().then((output) => { metrics.register.metrics().then((output) => {
res.set('Content-Type', metrics.register.contentType); res.set('Content-Type', metrics.register.contentType);
res.set('Cache-Control', 'private, no-store');
res.end(output); res.end(output);
}).catch((err) => { }).catch((err) => {
req.log.error(err, "Error collecting metrics"); req.log.error(err, "Error collecting metrics");
res.set('Cache-Control', 'private, no-store');
res.status(500).end(); res.status(500).end();
}); });
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment