Disable caching for config.json file (#421)

* Disable caching for config.json file

* Disable cache when fetching config.json
This commit is contained in:
Tanuj Mittal 2021-02-04 15:25:13 +05:30 committed by GitHub
parent 3b6fda4fa5
commit 3fd014ddad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 5 deletions

View File

@ -80,7 +80,11 @@ if (process.env.NODE_ENV === "development") {
export async function initializeConfiguration(): Promise<ConfigContext> { export async function initializeConfiguration(): Promise<ConfigContext> {
try { try {
const response = await fetch("./config.json"); const response = await fetch("./config.json", {
headers: {
"If-None-Match": "", // disable client side cache
},
});
if (response.status === 200) { if (response.status === 200) {
try { try {
const { allowedParentFrameOrigins, ...externalConfig } = await response.json(); const { allowedParentFrameOrigins, ...externalConfig } = await response.json();

View File

@ -34,26 +34,40 @@
<clientCache cacheControlMode="DisableCache" /> <clientCache cacheControlMode="DisableCache" />
</staticContent> </staticContent>
</system.webServer> </system.webServer>
</location> </location>
<location path="hostedExplorer.html"> <location path="hostedExplorer.html">
<system.webServer> <system.webServer>
<staticContent> <staticContent>
<clientCache cacheControlMode="DisableCache" /> <clientCache cacheControlMode="DisableCache" />
</staticContent> </staticContent>
</system.webServer> </system.webServer>
</location> </location>
<location path="config.json">
<system.webServer>
<staticContent>
<clientCache cacheControlMode="DisableCache" />
</staticContent>
</system.webServer>
</location>
<location path="mpac/explorer.html"> <location path="mpac/explorer.html">
<system.webServer> <system.webServer>
<staticContent> <staticContent>
<clientCache cacheControlMode="DisableCache" /> <clientCache cacheControlMode="DisableCache" />
</staticContent> </staticContent>
</system.webServer> </system.webServer>
</location> </location>
<location path="mpac/hostedExplorer.html"> <location path="mpac/hostedExplorer.html">
<system.webServer> <system.webServer>
<staticContent> <staticContent>
<clientCache cacheControlMode="DisableCache" /> <clientCache cacheControlMode="DisableCache" />
</staticContent> </staticContent>
</system.webServer> </system.webServer>
</location> </location>
<location path="mpac/config.json">
<system.webServer>
<staticContent>
<clientCache cacheControlMode="DisableCache" />
</staticContent>
</system.webServer>
</location>
</configuration> </configuration>