Skip to content

Intercept HTTP requests in standalone browser script #2192

Answered by kettanaito
sorasful asked this question in Q&A
Discussion options

You must be logged in to vote

Got it!

That's not going to work. MSW uses the Service Worker API in the browser. Since it allows you to intercept the traffic on a page, it has to be secure. One of its security measures is that the consumer has to serve the worker script. Just including a <script> tag will not do anything.

I generally advise against this pattern. Cross-domain network control is dangerous for both parties. If you can, avoid this and implement your API differently.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@sorasful
Comment options

@kettanaito
Comment options

Answer selected by kettanaito
@sorasful
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants