A browser extension to modify HTTP requests :-)
At first, Gooreplacer is created for redirecting Google Ajaxs/APIs/Fonts to other CDN to bypass Great Firewall, since pages referring those are slow as molasses.
Nowadays, more features have been added to gooreplacer, mainly:
- Block request
- Modify headers
- Export/Import rules, sync between Firefox/Chrome/Edge...
- Live Test
- i18n
Most users prefer gooreplacer than other similar extensions, HTTPS Everywhere/Redirector, for ease-of-use. Why not give it a try?
Browser | Rate | User |
---|---|---|
Currently gooreplacer support 4 functions. Take one exported rules as example:
{
"createBy": "https://github.com/jiacai2050/gooreplacer",
"version": "2.0",
"createAt": "Sun Oct 29 2017 19:55:32 GMT+0800 (CST)",
"redirect-rules": [
{
"src": "ajax.googleapis.com",
"dst": "ajax.proxy.ustclug.org",
"kind": "wildcard",
"enable": true
}
],
"cancel-rules": [
{
"src": "facebook.com",
"kind": "wildcard",
"enable": true
}
],
"request-headers": [
{
"src": "google.com",
"kind": "wildcard",
"name": "user-agent",
"value": "gooreplacer",
"op": "modify",
"enable": true
}
],
"response-headers": [
{
"src": "google.com",
"kind": "wildcard",
"name": "Cookie",
"op": "cancel",
"enable": true
}
]
}
redirect-rules
used for redirectscancel-rules
used for blocksrequest-headers
used for modify/cancel http request headersresponse-headers
used for modify/cancel http response headers
In each rule,
src
limit which request it will work on, and it has two types: wildcard and regexp, which is defined inkind
key.dst
only required in redirects, means destinationenable
turn on/offop
required inrequest-headers
response-headers
, has two enum value:cancel
ormodify
name
,value
required inrequest-headers
response-headers
, means header name(case-insensitive), header value
In redirects, you can use $1
$2
... to backreference captured groups in case of regexp
kind. For example:
{
"src": "https://search.yahoo.com/search\?p=([a-z]+)",
"dst": "https://www.google.com/search?q=$1",
"kind": "regexp",
"enable": true
}
Then https://search.yahoo.com/search?p=gooreplacer will redirect to https://www.google.com/search?q=gooreplacer
If your rules don't work as expected, use sandbox to test, it can tell what's missing.
-
In order to be compatiable with old versions,
redirect-rules
key in JSON-rules file can be justrules
and have following format:"rules": { "ajax.googleapis.com": { "dstURL": "ajax.proxy.ustclug.org", "enable": true, "kind": "wildcard" } }
-
According to Google Extension document,headers below can't be modified:
- Authorization
- Cache-Control
- Connection
- Content-Length
- Host
- If-Modified-Since
- If-None-Match
- If-Range
- Partial-Data
- Pragma
- Proxy-Authorization
- Proxy-Connection
- Transfer-Encoding
Gooreplacer is written in pure JavaScript before v1.0, you can check this version at legacy-js-src. After v2.0, gooreplacer get a big rewrite in ClojureScript + Reagent + Antd + React-Bootstrap,which is resident in cljs-src。
MIT License © Jiacai Liu