Home > Software design >  How to intercept ALL HTTP requests on html page
How to intercept ALL HTTP requests on html page

Time:07-13

I would like to intercept all of the HTTP requests an html page makes, I am using it to add a reverse-proxy URL to all the requests on a page, ( ex. https://proxy.url/{original_request_url} ) Say I had a link element for a css stylesheet:

<link rel="stylesheet" href="/style.css">

The link element would stay the same but when the browser requests the /style.css file, it would actually request https://proxy.url/style.css

Or say the website makes a fetch request

fetch("file.txt")

It should request https://proxy.url/file.txt

Oh, and I cant use Service Workers as this needs to run before anything loads and needs to stop the page from loading until it is done adding the reverse-proxy

CodePudding user response:

You can try a <base> tag. See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base

CodePudding user response:

I suggest you look into burp suite for a robust solution. Another easier option is the Resource Override browser extension.

  • Related