You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 11, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+13-73Lines changed: 13 additions & 73 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,8 @@
3
3
BrowserUp Proxy allows you to manipulate HTTP requests and responses, capture HTTP content, and export performance data as a [HAR file](http://www.softwareishard.com/blog/har-12-spec/).
4
4
BrowserUp Proxy works well as a standalone proxy server, but it is especially useful when embedded in Selenium tests.
5
5
6
-
The latest version of BrowserUp Proxy is 3.0.0-beta. BrowserUp Proxy is originally forked from [BrowserMobProxy](https://github.com/lightbody/browsermob-proxy) and is powered by [LittleProxy](https://github.com/adamfisk/LittleProxy).
6
+
BrowserUp Proxy is originally forked from [BrowserMobProxy](https://github.com/lightbody/browsermob-proxy) and is powered by [LittleProxy](https://github.com/adamfisk/LittleProxy).
7
+
See [CHANGELOG.md] for updates.
7
8
8
9
If you're running BrowserUp Proxy within a Java application or Selenium test, get started with [Embedded Mode](#getting-started-embedded-mode). If you want to run BUP from the
9
10
command line as a standalone proxy, start with [Standalone](#getting-started-standalone).
@@ -32,7 +33,7 @@ Then configure your HTTP client to use a proxy running at the specified port.
32
33
**Using with Selenium?** See the [Using with Selenium](#using-with-selenium) section.
33
34
34
35
### Getting started: Standalone
35
-
To run in standalone mode from the command line, first download the latest release from the [releases page](https://github.com/lightbody/BrowserUp-proxy/releases), or [build the latest from source](#building-the-latest-from-source).
36
+
To run in standalone mode from the command line, first download the latest release from the [releases page](https://github.com/browserup/browserup-proxy/releases), or [build the latest from source](#building-the-latest-from-source).
36
37
37
38
Start the REST API:
38
39
```sh
@@ -48,45 +49,6 @@ Then create a proxy server instance:
48
49
The "port" is the port of the newly-created proxy instance, so configure your HTTP client or web browser to use a proxy on the returned port.
49
50
For more information on the features available in the REST API, see [the REST API documentation](#rest-api).
50
51
51
-
## Changes since 2.0.0
52
-
53
-
The new [BrowserUpProxyServer class](browserup-proxy-core/src/main/java/com/browserup/bup/BrowserUpProxyServer.java) has replaced the legacy ProxyServer implementation. The legacy implementation is no longer actively supported; all new code should use `BrowserUpProxyServer`. We highly recommend that existing code migrate to the new implementation.
54
-
55
-
The most important changes from 2.0 are:
56
-
57
-
-[Separate REST API and Embedded Mode modules](#embedded-mode). Include only the functionality you need.
58
-
-[New BrowserUpProxy interface](browserup-proxy-core/src/main/java/com/browserup/bup/BrowserUpProxy.java). The new interface will completely replace the legacy 2.0 ProxyServer contract in version 3.0 and higher.
59
-
-[LittleProxy support](#littleproxy-support). More stable and more powerful than the legacy Jetty back-end.
60
-
61
-
### New BrowserUpProxy API
62
-
63
-
BrowserUp Proxy 2.1 includes a [new BrowserUpProxy interface](browserup-proxy-core/src/main/java/com/browserup/bup/BrowserUpProxy.java) to interact with BrowserUp Proxy programmatically. The new interface defines the functionality that BrowserUp Proxy will support in future releases (including 3.0+). To ease migration, both the legacy (Jetty-based) ProxyServer class and the new, LittleProxy-powered BrowserUpProxy class support the new BrowserUpProxy interface.
64
-
65
-
We _highly_ recommend migrating existing code to the BrowserUpProxy interface using the `BrowserUpProxyServer` class.
66
-
67
-
### Using the LittleProxy implementation with 2.0.0 code
68
-
69
-
The legacy interface, implicitly defined by the ProxyServer class, has been extracted into `com.browserup.bup.proxy.LegacyProxyServer` and is now officially deprecated. The new LittleProxy-based implementation will implement LegacyProxyServer for all 2.1.x releases. This means you can switch to the LittleProxy-powered implementation with minimal change to existing code ([with the exception of interceptors](#http-request-manipulation)):
70
-
71
-
```java
72
-
// With the Jetty-based 2.0.0 release, BUP was created like this:
73
-
ProxyServer proxyServer =newProxyServer();
74
-
proxyServer.start();
75
-
// [...]
76
-
77
-
// To use the LittleProxy-powered 2.1.4 release, simply change to
78
-
// the LegacyProxyServer interface and the adapter for the new
// Almost all deprecated 2.0.0 methods are supported by the
83
-
// new BrowserUpProxyServerLegacyAdapter implementation, so in most cases,
84
-
// no further code changes are necessary
85
-
```
86
-
87
-
LegacyProxyServer will not be supported after 3.0 is released, so we recommend migrating to the `BrowserUpProxy` interface as soon as possible. The new interface provides additional functionality and is compatible with both the legacy Jetty-based ProxyServer implementation [(with some exceptions)](new-interface-compatibility.md) and the new LittleProxy implementation.
88
-
89
-
If you must continue using the legacy Jetty-based implementation, include the `browserup-proxy-core-legacy` artifact instead of `browserup-proxy-core`.
90
52
91
53
## Features and Usage
92
54
@@ -101,8 +63,6 @@ The proxy is programmatically controlled via a REST interface or by being embedd
101
63
102
64
### REST API
103
65
104
-
**New in 2.1:** LittleProxy is the default implementation of the REST API. You may specify `--use-littleproxy false` to disable LittleProxy in favor of the legacy Jetty 5-based implementation.
105
-
106
66
To get started, first start the proxy by running `BrowserUp-proxy` or `BrowserUp-proxy.bat` in the bin directory:
107
67
108
68
$ sh BrowserUp-proxy -port 8080
@@ -156,7 +116,6 @@ Empties the DNS cache | DELETE | */proxy/[port]/dns/cache* ||
156
116
|[REST API interceptors with LittleProxy](#interceptorsRESTapiLP)|||
157
117
|Describe your own request interception | POST |*/proxy/[port]/filter/request*| A string which determinates interceptor rules. See more [here](#interceptorsRESTapiLPRequestFilter)|
158
118
|Describe your own response interception | POST |*/proxy/[port]/filter/response*| A string which determinates interceptor rules. See more [here](#interceptorsRESTapiLPResponseFilter)|
159
-
|[REST API with Legacy interceptors](#interceptorsRESTapiLegacy)||||
160
119
|Describe your own request interception | POST |*/proxy/[port]/interceptor/request*| A string which determinates interceptor rules. See more [here](#interceptorsRESTapiLegacy)|
161
120
|Describe your own response interception | POST |*/proxy/[port]/interceptor/response*| A string which determinates interceptor rules. See more [here](#interceptorsRESTapiLegacy)|
162
121
@@ -194,18 +153,15 @@ system properties will be used to specify the upstream proxy.
194
153
195
154
### Embedded Mode
196
155
197
-
**New in 2.1:** New Embedded Mode module
198
-
199
-
**New in 2.1:** New [BrowserUpProxy interface](#new-BrowserUpproxy-api) for Embedded Mode
200
156
201
-
BrowserUp Proxy 2.1 separates the Embedded Mode and REST API into two modules. If you only need Embedded Mode functionality, add the `browserup-proxy-core` artifact as a dependency. The REST API artifact is `BrowserUp-rest`.
157
+
BrowserUp Proxy separates the Embedded Mode and REST API into two modules. If you only need Embedded Mode functionality, add the `BrowserUp-core` artifact as a dependency. The REST API artifact is `BrowserUp-rest`.
202
158
203
159
If you're using Java and Selenium, the easiest way to get started is to embed the project directly in your test. First, you'll need to make sure that all the dependencies are imported in to the project. You can find them in the *lib* directory. Or, if you're using Maven, you can add this to your pom:
204
160
```xml
205
161
<dependency>
206
162
<groupId>com.browserup.bup</groupId>
207
163
<artifactId>browserup-proxy-core</artifactId>
208
-
<version>2.1.4</version>
164
+
<version>1.0.0/version>
209
165
<scope>test</scope>
210
166
</dependency>
211
167
```
@@ -258,9 +214,9 @@ BrowserUp Proxy makes it easy to use a proxy in Selenium tests:
258
214
created by `createSeleniumProxy()` to point to the hostname of the machine that your test is running on. You can also run a standalone
259
215
BrowserUp Proxy instance on a separate machine and configure the Selenium Proxy object to use that proxy.
260
216
261
-
#### 2.1.0+ (LittleProxy) interceptors
217
+
#### (LittleProxy) interceptors
262
218
263
-
There are four new methods to support request and response interception in LittleProxy:
219
+
There are four methods to support request and response interception in LittleProxy:
264
220
265
221
-`addRequestFilter`
266
222
-`addResponseFilter`
@@ -300,7 +256,7 @@ For most use cases, including inspecting and modifying requests/responses, `addR
<aname="interceptorsRESTapiLegacy"></a>You can also POST a JavaScript payload to `/:port/interceptor/request` and `/:port/interceptor/response` using the REST interface. The functions will have a `request`/`response` variable, respectively, and a `har` variable (which may be null if a HAR isn't set up yet). The JavaScript code will be run by [Rhino](https://github.com/mozilla/rhino) and have access to the same Java API in the example above:
354
-
355
-
[~]$ curl -X POST -H 'Content-Type: text/plain' -d 'request.getMethod().removeHeaders("User-Agent");' http://localhost:8080/proxy/8081/interceptor/request
356
-
357
-
Consult the Java API docs for more info.
358
-
359
296
### SSL Support
360
297
361
-
**BrowserUp Proxy 2.1.0+ now supports full MITM:** For most users, MITM will work out-of-the-box with default settings. Install the [ca-certificate-rsa.cer](/browserup-proxy-core/src/main/resources/sslSupport/ca-certificate-rsa.cer) file in your browser or HTTP client to avoid untrusted certificate warnings. Generally, it is safer to generate your own private key, rather than using the .cer files distributed with BrowserUp Proxy. See the [README file in the `mitm` module](/mitm/README.md) for instructions on generating or using your own root certificate and private key with MITM.
298
+
**BrowserUp Proxy supports full MITM:** For most users, MITM will work out-of-the-box with default settings. Install the [ca-certificate-rsa.cer](/BrowserUp-core/src/main/resources/sslSupport/ca-certificate-rsa.cer) file in your browser or HTTP client to avoid untrusted certificate warnings. Generally, it is safer to generate your own private key, rather than using the .cer files distributed with BrowserUp Proxy. See the [README file in the `mitm` module](/mitm/README.md) for instructions on generating or using your own root certificate and private key with MITM.
362
299
363
300
**Note: DO NOT** permanently install the .cer files distributed with BrowserUp Proxy in users' browsers. They should be used for testing only and must not be used with general web browsing.
364
301
365
302
If you're doing testing with Selenium, you'll want to make sure that the browser profile that gets set up by Selenium not only has the proxy configured, but also has the CA installed. Unfortunately, there is no API for doing this in Selenium; it must be done manually for each browser and environment.
366
303
367
304
### NodeJS Support
368
305
369
-
NodeJS bindings for browswerup-proxy are available [here](https://github.com/zzo/BrowserUp-node). Built-in support for [Selenium](http://seleniumhq.org) or use [CapserJS-on-PhantomJS](http://casperjs.org) or anything else to drive traffic for HAR generation.
306
+
We are compatible with the browsermob proxy, so you could probably fork this and get it going
0 commit comments