elazarl / goproxy

An HTTP proxy library for Go
BSD 3-Clause "New" or "Revised" License
5.98k stars 1.09k forks source link

how to add a javscript to every .html, .htm, .jsp request #128

Open anjanb opened 8 years ago

anjanb commented 8 years ago

I'd like to inject a script like below into all the responses for requests coming from the browser. This should happen if the browser is requesting for .jsp, .html, .htm, .shtml, and not for requests for .css, .js, .jpg, etc.

How can I do it ?

<script type="text" scr="foo.js>

elazarl commented 8 years ago

Parse the HTML and inject the JS there.

On Tue, Oct 13, 2015 at 5:45 PM, anjanb notifications@github.com wrote:

I'd like to inject a script like below into all the responses for requests coming from the browser. This should happen if the browser is requesting for .jsp, .html, .htm, .shtml, and not for requests for .css, .js, .jpg, etc.

How can I do it ?

— Reply to this email directly or view it on GitHub https://github.com/elazarl/goproxy/issues/128.