Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to intercept GET requests and fake the responses

349 views
Skip to first unread message

orbiter

unread,
Jul 15, 2009, 4:43:17 AM7/15/09
to
Hi,
I'm new to the whole firefox customization thing and the only thing
I've done so far is write some simple greasmonkey scripts to clean up
and simplify certain websites I constantly visit. Mainly removing ads
and posting links to my del.icio.us account with xmlHttpRequest. So
what I currently would like to do is intercept "useless" GET requests
fired by javascript scripts and fake the responses from my local
firefox session. I say "useless" because most of these requests are
used to modify the page after I visit it by pulling in ad information
and some other useless junk that is completely irrelevant to the
site's main function. I've looked into running a local filtering proxy
but if I can do it from within firefox then that would be preferable.
Appreciate any help you guys can provide.

Ralph Fox

unread,
Jul 15, 2009, 5:17:01 AM7/15/09
to
On Wed, 15 Jul 2009 01:43:17 -0700 (PDT), in message <f6f5aa19-4a58-437e...@h2g2000yqg.googlegroups.com>
orbiter <dkara...@gmail.com> wrote:

> X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1)
> Gecko/20090624 Firefox/3.5,gzip(gfe),gzip(gfe)


Write yourself a proxy.pac (proxy auto-config) script to catch the
unwanted URLs and point Firefox to a non-existent proxy for them.

Put the proxy.pac file somewhere on your hard drive. In Firefox for
Linux, go to "Edit � Preferences � Advanced � Network � Settings"
and enter the file:/// URL to the proxy.pac file in the box labelled
"Automatic proxy configuration URL".


More information: http://en.wikipedia.org/wiki/Proxy_auto-config

--
Regards
Ralph

orbiter

unread,
Jul 15, 2009, 1:19:25 PM7/15/09
to
On Jul 15, 2:17 am, Ralph Fox <-rf-...@-.invalid> wrote:
> On Wed, 15 Jul 2009 01:43:17 -0700 (PDT), in message <f6f5aa19-4a58-437e-817f-1087a8c2c...@h2g2000yqg.googlegroups.com>

This is a step in the right direction and with some extra plumbing I
think I could get it to do what I want. To be more specific I would
basically like a server with scripting capabilities that sits between
firefox and the target server I'm connecting to with firefox. In terms
of diagrams: firefox<--->programmable proxy<--->server. I not only
want to drop requests but I want to also modify the response so that
firefox and the site I'm currently on think the request was successful.

Ralph Fox

unread,
Jul 16, 2009, 5:24:31 AM7/16/09
to


1. If a "successful" response is sufficient by itself (you don't need
to return different content for different intercepted URLs), then
you could use a proxy.pac script to point the unwanted URLs to a
simple local proxy which returrns a (say) 1x1 transparent GIF image
to any request.


2. If not, maybe one of these could be useful

BFilter ........ http://bfilter.sourceforge.net/

Privoxy ........ http://www.privoxy.org/

Proxomitron .... http://www.sankey.ws/proxomitron.html

--
Regards
Ralph

orbiter

unread,
Jul 16, 2009, 11:54:21 AM7/16/09
to
On Jul 16, 2:24 am, Ralph Fox <-rf-...@-.invalid> wrote:
> On Wed, 15 Jul 2009 10:19:25 -0700 (PDT), in message <c20965fa-25b7-4a74-94db-2174d7275...@k1g2000yqf.googlegroups.com>

Privoxy did the trick, thanks.

orbiter

unread,
Jul 16, 2009, 12:42:09 PM7/16/09
to
On Jul 16, 2:24 am, Ralph Fox <-rf-...@-.invalid> wrote:
> On Wed, 15 Jul 2009 10:19:25 -0700 (PDT), in message <c20965fa-25b7-4a74-94db-2174d7275...@k1g2000yqf.googlegroups.com>

Privoxy did the trick, thanks.

orbiter

unread,
Jul 16, 2009, 12:54:18 PM7/16/09
to
On Jul 16, 2:24 am, Ralph Fox <-rf-...@-.invalid> wrote:
> On Wed, 15 Jul 2009 10:19:25 -0700 (PDT), in message <c20965fa-25b7-4a74-94db-2174d7275...@k1g2000yqf.googlegroups.com>

Privoxy did the trick, thanks.

0 new messages