diff --git a/src/artifacts.js b/src/artifacts.js index 8cbb6a56..f06b8a72 100644 --- a/src/artifacts.js +++ b/src/artifacts.js @@ -353,9 +353,13 @@ var replyWithArtifact = async function(taskId, runId, name, req, res) { var bucket = artifact.details.bucket; if (bucket === this.publicBucket.bucket) { + let skipCacheHeader = (req.headers['x-taskcluster-skip-cache'] || '').toLowerCase(); if (!region) { debug('artifact from CDN for ip: %s', req.headers['x-forwarded-for']); url = this.publicBucket.createGetUrl(prefix); + } else if (skipCacheHeader === 'true' || skipCacheHeader === '1') { + // Skip cache and go to cloud-front + url = this.publicBucket.createGetUrl(prefix); } else if (this.artifactRegion === region) { url = this.publicBucket.createGetUrl(prefix, true); } else { @@ -446,6 +450,13 @@ api.declare({ 'stored externally. Either way, the response may not be JSON. So API', 'client users might want to generate a signed URL for this end-point and', 'use that URL with a normal HTTP client.', + '', + '**Caching**, artifacts may be cached in data centers closer to the', + 'workers in-order to reduce bandwidth costs. This can lead to longer', + 'response times. Caching can be skipped by setting the header', + '`x-taskcluster-skip-cache: true`, this should only be used for resources', + 'where request volume is known to be low, and caching not useful.', + '(This feature may be disabled in the future, use is sparingly!)', ].join('\n'), }, async function(req, res) { var taskId = req.params.taskId;