-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Caching issue with gtfs.org #23
Comments
Hi Brian, the website is hosted by GitHub (GitHub Pages), the domain is verified by them and all the DNS are set properly (verified twice). Updates are therefore pushed automatically from a specific branch on the repo by GitHub. Therefore we have little to no control over the whole hosting side, besides turning it on and off essentially. The old site was hosted on an Amazon S3 bucket, but nothing should still connect to that anymore. Force reloading the page usually works, no idea why the old website is still being showed, and it's been doing that unpredictably since the new site was launched. This is the gist of it, from my perspective. |
If the start page is not being cached client-side indefinitely, would it be a fix if MobilityData were to serve a script that explicitly clears all service workers? |
The issue is that we do not have control over the webserver. The pages are in markdown converted to HTML and deployed by GitHub themselves. And the client would need to load the new page in order to see the script and clear its caches. Every trick to force the client to empty its caches require it to load the new page in order to get this command. |
I missed that the start page is cached by the service worker as well. @bdferris-v2 Does the service worker also respond with data for pages that you have never visited in this browser session, e.g. ones that don't exist? We could serve a custom script there. |
It is a tricky problem, but I see two possible paths:
Critically, I think this a potential point of ingress. Specifically, I believe you can upload a What should be in
Per https://stackoverflow.com/questions/33704791/how-do-i-uninstall-a-service-worker
|
@scmcca I think there's a possible fix here, as explained by Brian. Do you believe it would be possible to add this file at the root and have MKDocs export it in the gh-pages branch? |
I went ahead and added an empty Please let me know if the issue has resolved, otherwise we could try putting some code in the file. Thanks! |
I think that fixed it! I'm now seeing the updated site and on DevTool inspection, I see a blank sw.js Service Worker loaded in Chrome. |
@bdferris-v2 Incredible! Thank you for the on-the-nose insight. Should we assume this as a solution for all browsers? |
I think so? Mozilla mentions similar update frequency. |
Well that's awesome. This was beyond my knowledge pool. I'm glad it got resolved. Perhaps we'll see the impacts in Google Analytics :-) Thank you Brian! |
A friend just told me about the |
I've had an issue where gtfs.org seems to be showing stale/old content. The site looks like the following for me:
Clicking through to links like "Static" shows a version of the GTFS spec that hasn't been updated since 2019. Apparently others have experienced this as well?
Doing some digging, I'm not 100% sure what's going on, but here is some speculation on what might be going that might help (or hinder!) any follow-up investigations:
Critically, I see the latest, updated version of the site if I load the page in an Incognito window in Chrome.
When I load https://gtfs.org/ or https://gtfs.org/reference/static in a regular Chrome window with DevTools running, I see that most of the page content is actually coming from a Service Worker running for the site:
My understanding is that this means that no content is actually been pulled over the network, but instead a Service Worker is intercepting the request and returning content.
Looking a bit closer at the Service Worker:
sw.js:
It appears there is a Worbox service worker serving as an application-level cache in front of a Gatsby CMS.
Now, when I compare that to https://gtfs.org/ loaded from an Incognito tab or on a different computer, I don't see a Service Worker or Gatsby-style content. Looks like a different site with a different framework.
So not knowing anything about how gtfs.org is run or setup, I'm guessing at some point in the past, it was configured with Workbox + Gatsby, but was then migrated to something else. But Service Workers appear to be pernicious, especially when it comes to caching. See also Service Workers Break the Browser’s Refresh Button by Default; Here’s Why. I /think/ a force-refresh of the page fixes the issue, but I wanted to keep my browser in its current state in case it helps with investigations.
The text was updated successfully, but these errors were encountered: