Remove cache control from meta data endpoint (#237)

* Remove cache control from meta data endpoint

* Run prettier

* Added a comment
This commit is contained in:
Sagiv Frankel 2023-02-23 11:33:14 +02:00 коммит произвёл GitHub
Родитель c4879740fb
Коммит 41e8fc6296
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -39,7 +39,19 @@ export class CloudSettings {
}
try {
const response = await axios.get<{ AzureAD: CloudInfo | undefined }>(kustoUri + this.METADATA_ENDPOINT);
const response = await axios.get<{ AzureAD: CloudInfo | undefined }>(kustoUri + this.METADATA_ENDPOINT, {
headers: {
"Cache-Control": "no-cache",
// Disable caching - it's being cached in memory (Service returns max-age).
// The original motivation for this is due to a CORS issue in Ibiza due to a dynamic subdomain.
// The first dynamic subdomain is attached to the cache and for some reason isn't invalidated
// when there is a new subdomain. It causes the request failure due to CORS.
// Example:
// Access to XMLHttpRequest at 'https://safrankecc.canadacentral.kusto.windows.net/v1/rest/auth/metadata' from origin
// 'https://sandbox-46-11.reactblade.portal.azure.net' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value
// 'https://sandbox-46-10.reactblade.portal.azure.net' that is not equal to the supplied origin.
},
});
if (response.status === 200) {
this.cloudCache[kustoUri] = response.data.AzureAD || this.defaultCloudInfo;
} else {