[GH-ISSUE #4628] [bug]: Service worker caching the wrong version #1716

Open
opened 2026-03-16 21:30:54 +03:00 by kerem · 4 comments
Owner

Originally created by @LorenzoRogai on GitHub (Dec 18, 2024).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4628

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Currently, when I reload the page after the initial load, it breaks. The issue seems to stem from the service worker caching an incorrect version with the wrong environment variables. However, if I perform a hard reload (CMD + Shift + R) or de-register the service worker, the page loads correctly.

For reference, i'm using Caddy as reverse proxy.

Steps to reproduce

Can't reproduce, probably it happens only if you change the env variables after a first docker-compose up -d

Environment

Production

Version

Self-hosted

Originally created by @LorenzoRogai on GitHub (Dec 18, 2024). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4628 ### Is there an existing issue for this? - [X] I have searched the existing issues ### Current behavior Currently, when I reload the page after the initial load, it breaks. The issue seems to stem from the service worker caching an incorrect version with the wrong environment variables. However, if I perform a hard reload (CMD + Shift + R) or de-register the service worker, the page loads correctly. For reference, i'm using Caddy as reverse proxy. ### Steps to reproduce Can't reproduce, probably it happens only if you change the env variables after a first docker-compose up -d ### Environment Production ### Version Self-hosted
Author
Owner

@LordSimal commented on GitHub (Jan 21, 2025):

Same issue with NGINX as a reverse proxy on self-hosted 2024.12.1

Its cool, that you already identified, that its a service worker problem. Therefore it can't really be a webserver/HTTP cache problem imho, but rather a cache invalidation problem inside the service worker.

Do you know where in the source code one could easily disable the service worker for self-hosted installations? At least this would fix that annoying bug for the time being.

<!-- gh-comment-id:2605025983 --> @LordSimal commented on GitHub (Jan 21, 2025): Same issue with NGINX as a reverse proxy on self-hosted [2024.12.1](https://github.com/hoppscotch/hoppscotch/tree/2024.12.1) Its cool, that you already identified, that its a service worker problem. Therefore it can't really be a webserver/HTTP cache problem imho, but rather a cache invalidation problem inside the service worker. Do you know where in the source code one could easily disable the service worker for self-hosted installations? At least this would fix that annoying bug for the time being.
Author
Owner

@LorenzoRogai commented on GitHub (Jan 21, 2025):

@LordSimal no i wasn't able to find a way to disable them in the source code, in the meanwhile i'm using a Chrome extension https://chromewebstore.google.com/detail/block-service-workers/ceokjgeibfjfcboemhdpkdalankbmnej?hl=en that blocks them

<!-- gh-comment-id:2605723380 --> @LorenzoRogai commented on GitHub (Jan 21, 2025): @LordSimal no i wasn't able to find a way to disable them in the source code, in the meanwhile i'm using a Chrome extension https://chromewebstore.google.com/detail/block-service-workers/ceokjgeibfjfcboemhdpkdalankbmnej?hl=en that blocks them
Author
Owner

@LordSimal commented on GitHub (Jan 21, 2025):

it looks like they are using workbox as the lib to write the service worker logic
https://github.com/hoppscotch/hoppscotch/blob/main/packages/hoppscotch-selfhost-web/package.json#L42

<!-- gh-comment-id:2605856149 --> @LordSimal commented on GitHub (Jan 21, 2025): it looks like they are using workbox as the lib to write the service worker logic https://github.com/hoppscotch/hoppscotch/blob/main/packages/hoppscotch-selfhost-web/package.json#L42
Author
Owner

@LordSimal commented on GitHub (Jan 22, 2025):

Maybe commenting out this config block could help, but I don't know how to trigger a rebuild of the web app
https://github.com/hoppscotch/hoppscotch/blob/main/packages/hoppscotch-selfhost-web/vite.config.ts#L150-L227

<!-- gh-comment-id:2606614186 --> @LordSimal commented on GitHub (Jan 22, 2025): Maybe commenting out this config block could help, but I don't know how to trigger a rebuild of the web app https://github.com/hoppscotch/hoppscotch/blob/main/packages/hoppscotch-selfhost-web/vite.config.ts#L150-L227
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#1716
No description provided.