Skip to content

Commit

Permalink
Add cache buster
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Dec 6, 2022
1 parent eca394c commit 61c8ae4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
9 changes: 8 additions & 1 deletion products/jbrowse-web/src/SessionLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,14 @@ const SessionLoader = types
},

async fetchConfig() {
const { configPath = 'config.json' } = self
let { configPath = 'config.json' } = self

// @ts-ignore
// eslint-disable-next-line no-underscore-dangle
if (window.__jbrowseCacheBuster) {
configPath += `?rand=${Math.random()}`
}

const text = await openLocation({
uri: configPath,
locationType: 'UriLocation',
Expand Down
23 changes: 23 additions & 0 deletions website/docs/config_guides/avoiding_stale_config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
id: avoiding_stale_config
title: Avoiding stale config
toplevel: true
---

Some servers strongly cache the "config.json" file. If you want to avoid this,
you can edit the index.html of JBrowse to include the following

```
<!DOCTYPE html>
<html lang="en">
<head>
<script>
window.__jbrowseCacheBuster = true
</script>
<meta charset="utf-8" />
```

This will request the config.json file with a random query string appended to
force the data to be fetched from the server instead of being loaded from the
local browser cache

0 comments on commit 61c8ae4

Please sign in to comment.