From a9f916be2cef2b2592a0f7ed301d128aa135f833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Volds=C3=A6ter?= <ole.voldsater@uib.no> Date: Thu, 10 Jun 2021 10:21:12 +0200 Subject: [PATCH] =?UTF-8?q?re=20meta#343=20query-parameter=20for=20=C3=A5?= =?UTF-8?q?=20omg=C3=A5=20dloudfront-cache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aws/beta.ordbok.uib.no_stack.yaml | 1 + src/components/DictionaryView.vue | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/aws/beta.ordbok.uib.no_stack.yaml b/aws/beta.ordbok.uib.no_stack.yaml index 244091ad..06d64a0a 100644 --- a/aws/beta.ordbok.uib.no_stack.yaml +++ b/aws/beta.ordbok.uib.no_stack.yaml @@ -112,6 +112,7 @@ Resources: HeaderBehavior: whitelist Headers: - "x-api-key" + - cachebuster Distribution: Type: "AWS::CloudFront::Distribution" Properties: diff --git a/src/components/DictionaryView.vue b/src/components/DictionaryView.vue index 20d9e28c..1243494c 100644 --- a/src/components/DictionaryView.vue +++ b/src/components/DictionaryView.vue @@ -91,7 +91,11 @@ axios.interceptors.request.use(function (config) { }); function navigate_to_article(self, source) { - axios.get(api_endpoint + '/' + self.$route.params.lang + '/article/' + self.$route.params.id) + let config = {headers: {}} + if ((self.$route.query.nocache || '').toLowerCase() == 'true') { + config.headers.cachebuster = Date.now() + } + axios.get(api_endpoint + '/' + self.$route.params.lang + '/article/' + self.$route.params.id, config) .then(function(response){ self.article = Object.assign(response.data, {'dictionary': self.$route.params.lang, source: source, results: self.search_results}) self.search_results = [] -- GitLab