Hello there,
We are currently utilizing an open-source CMS that recently received an upgrade with a new feature - a javascript serviceworker implementation to manage all requests.
This CMS includes workflow forms where users engage (created by us). During the design phase, you have the ability to insert custom HTML elements known as special snippet elements, which can contain any JS, HTML, and CSS code.
We developed a button that triggers a $.get() call to a Python Flask server hosted online on the same machine-instance (https://localhost:5000/).
In the earlier version of the CMS without the serviceworker, if we stopped the Flask server, our $.get() call upon button click would result in an expected error response (404/500), allowing us to handle it using the ".fail()" jQuery function. When the Flask server was active, we handled it within the ".done()" segment.
However, after the upgrade, every scenario is ending up in the ".done()" segment. This is because even when it should fail due to the offline Flask server, the serviceworker intercepts it and falsely resolves it with an OK status (200):
https://example.com/image1.png https://example.com/image2.png
When in reality, the server is down:
https://example.com/image3.png
So, how can we prevent the serviceworker from intercepting the ajax call without being able to modify the serviceworker code itself? Is there a way to extend it so that the "fetch" listener can validate against the "/api" URL and just "return;"?
This is the exact point where Chrome indicates the issue:
https://example.com/image4.png
And this is a snippet of the function code:
Your modified function code here...
Thank you for your assistance!